From 19ef2195a640da43dacefc456add392e4ef96fb2 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Fri, 2 Feb 2024 11:39:06 +0530 Subject: [PATCH 01/26] Updated version to v178 --- .../3D_Feature_Sample_App.cpp | 43 +- Samples/Color_Samples/Color_Sample_App.cpp | 33 +- .../CombinedDisplay_Sample_App.cpp | 52 +- .../CustomMode_Sample_App.cpp | 33 +- .../DisplayGenlock_Sample_App.cpp | 518 +++++++++++------- .../DynamicContrastEnhancement_Sample_App.cpp | 38 +- .../Edid_Mgmt_Sample_App.cpp | 72 ++- Samples/Generic_Sample/Sample_ControlAPP.cpp | 320 +++++++---- .../I2C_AUX_Samples/I2C_AUX_Sample_App.cpp | 33 +- Samples/IntelArcSync/IntelArcSync_App.cpp | 36 +- Samples/Media_Samples/Media_Sample_App.cpp | 51 +- .../Sample_OverclockAPP.cpp | 30 +- .../Panel_descriptor_Sample_App.cpp | 33 +- .../PowerFeature_Sample_App.cpp | 33 +- Samples/Scaling_Samples/Scaling_App.cpp | 33 +- Samples/ScdcRead/ScdcReadApp.cpp | 33 +- .../Telemetry_Samples/Sample_TelemetryAPP.cpp | 102 +++- Samples/UBRR_Sample/UBRR_Sample_App.cpp | 33 +- includes/igcl_api.h | 96 ++++ wrapper/cApiWrapper.cpp | 44 ++ 20 files changed, 1213 insertions(+), 453 deletions(-) diff --git a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp index 7cc0262..e618b5c 100644 --- a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp +++ b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp @@ -908,13 +908,29 @@ int main() CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); - Result = ctlInit(&CtlInitArgs, &hAPIHandle); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { @@ -924,12 +940,20 @@ int main() return CTL_RESULT_ERROR_INVALID_NULL_POINTER; } - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } if (CTL_RESULT_SUCCESS != Result) { printf("ctlEnumerateDevices returned failure code: 0x%X\n", Result); - goto free_exit; + goto Exit; } for (Index = 0; Index < AdapterCount; Index++) @@ -937,7 +961,14 @@ int main() if (CTL_RESULT_SUCCESS == Result) { - Result = CtlGet3DFeatureCaps(hDevices[Index]); + try + { + Result = CtlGet3DFeatureCaps(hDevices[Index]); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS != Result) { @@ -991,7 +1022,7 @@ int main() { STORE_RESET_ERROR(Result); } -free_exit: +Exit: ctlClose(hAPIHandle); diff --git a/Samples/Color_Samples/Color_Sample_App.cpp b/Samples/Color_Samples/Color_Sample_App.cpp index 2544ee2..42f34c3 100644 --- a/Samples/Color_Samples/Color_Sample_App.cpp +++ b/Samples/Color_Samples/Color_Sample_App.cpp @@ -2158,19 +2158,40 @@ int main() CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, NULL); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, NULL); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Result = TestDisplays(AdapterCount, hDevices); LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "TestDisplays"); diff --git a/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp b/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp index 370679a..3bc1ab3 100644 --- a/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp +++ b/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp @@ -680,22 +680,58 @@ int main(int argc, char *pArgv[]) CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, NULL); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, NULL); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } - Result = TestCombinedDisplay(AdapterCount, hDevices, pCDArgFile, CombinedPort); - LOG_AND_EXIT_ON_ERROR(Result, "TestCombinedDisplay"); + try + { + Result = TestCombinedDisplay(AdapterCount, hDevices, pCDArgFile, CombinedPort); + LOG_AND_EXIT_ON_ERROR(Result, "TestCombinedDisplay"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + catch (const std::ios_base::failure &e) + { + printf("%s \n", e.what()); + } + catch (const std::bad_cast &e) + { + printf("%s \n", e.what()); + } Exit: diff --git a/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp b/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp index 80d5ccd..6d06d12 100644 --- a/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp +++ b/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp @@ -351,19 +351,40 @@ int main() CtlInitArgs.Version = 0; ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Result = EnumerateTargetDisplays(hDisplayOutput, AdapterCount, hDevices); diff --git a/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp b/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp index 52cfe6a..e5b61a0 100644 --- a/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp +++ b/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp @@ -23,6 +23,7 @@ #include #include #include +#include using namespace std; #define CTL_APIEXPORT // caller of control API DLL shall define this before including igcl_api.h @@ -30,12 +31,14 @@ using namespace std; #include "igcl_api.h" #include "GenericIGCLApp.h" +#define NUMBER_OF_PRIMARY_ADAPTERS 1 + typedef struct _genlock_sample_args { bool IsGenlockPrimary; ctl_genlock_operation_t Operation; ctl_display_output_types_t PortType; - uint32_t NumberOfPrimaryAdapters; + uint32_t PrimaryBusId; } genlock_sample_args; static bool IsGetVBlankTs = false; @@ -95,8 +98,8 @@ void PrintUsage(char *pArgv[]) printf("-d [Display type]\n"); printf("\tdp : Display Port (default)\n"); printf("\thdmi : HDMI\n"); - printf("-n [Number of Primary Adapters]\n"); - printf("\tSpecify how many adapters you want to enable as a primary (default : 1)\n"); + printf("-p [PCIe BUS ID of Primary Adapter]\n"); + printf("\tDesignate PCIe BUS ID of adapter you want to set as a primary (default : 0)\n"); } /*************************************************************** @@ -139,9 +142,9 @@ ctl_result_t GetCmdlineArgs(int Argc, char *pArgv[], genlock_sample_args *pGenlo string OptionArg; // initialize Genlock Sample Args - pGenlockSampleArgs->PortType = CTL_DISPLAY_OUTPUT_TYPES_DISPLAYPORT; - pGenlockSampleArgs->NumberOfPrimaryAdapters = 1; - pGenlockSampleArgs->IsGenlockPrimary = true; + pGenlockSampleArgs->PortType = CTL_DISPLAY_OUTPUT_TYPES_DISPLAYPORT; + pGenlockSampleArgs->IsGenlockPrimary = true; + pGenlockSampleArgs->PrimaryBusId = 0; if (CTL_RESULT_SUCCESS == FindOptionArg(Argc, pArgv, "-timing", OptionArg)) { @@ -192,8 +195,8 @@ ctl_result_t GetCmdlineArgs(int Argc, char *pArgv[], genlock_sample_args *pGenlo } } printf("[in] Display Type: %s\n", pGenlockSampleArgs->PortType == CTL_DISPLAY_OUTPUT_TYPES_HDMI ? "hdmi" : "dp"); - // Number of Primary Adapters option - if (CTL_RESULT_SUCCESS == FindOptionArg(Argc, pArgv, "-n", OptionArg)) + // Primary BUS ID option + if (CTL_RESULT_SUCCESS == FindOptionArg(Argc, pArgv, "-p", OptionArg)) { if (("" != OptionArg)) { @@ -201,20 +204,116 @@ ctl_result_t GetCmdlineArgs(int Argc, char *pArgv[], genlock_sample_args *pGenlo { if (!isdigit(OptionArg[Index])) { - printf("Invalid Number of primary adapters.\n"); + printf("Invalid PCIe BUS ID.\n"); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } } - pGenlockSampleArgs->NumberOfPrimaryAdapters = stoul(OptionArg, 0, 16); + pGenlockSampleArgs->PrimaryBusId = stoul(OptionArg, 0, 10); } } - printf("[in] Number of primary adapters: %u\n", pGenlockSampleArgs->NumberOfPrimaryAdapters); + printf("[in] BUS ID of primary adapter: %u\n", pGenlockSampleArgs->PrimaryBusId); Exit: return Result; } +/*************************************************************** + * @brief GetVblankTimestamp + * get vblank time stamp + * @param hDevices, AdapterCount + * @return ctl_result_t + ***************************************************************/ +ctl_result_t GetVblankTimestamp(ctl_device_adapter_handle_t *hDevices, uint32_t AdapterCount) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_device_adapter_handle_t hFailureDeviceAdapter = NULL; + ctl_display_output_handle_t *hDisplayOutput = NULL; + ctl_display_output_handle_t *hActiveDisplayOutputs = NULL; + uint32_t DisplayCount = 0; + uint8_t ActiveDisplayCount = 0; + uint8_t MaxNumDisplayOutputs = 0; + bool IsDisplayActive = false; + bool IsDisplayAttached = false; + ctl_vblank_ts_args_t VblankTsArgs; + + for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) + { + ActiveDisplayCount = 0; + + // Enumerate all the possible target displays for the adapters + // First step is to get the count + DisplayCount = 0; + + Result = ctlEnumerateDisplayOutputs(hDevices[AdapterIndex], &DisplayCount, NULL); + + if (CTL_RESULT_SUCCESS != Result) + { + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + } + else if (DisplayCount <= 0) + { + printf("Invalid Display Count. Skipping display enumeration for adapter: %d\n", AdapterIndex); + continue; + } + + hDisplayOutput = (ctl_display_output_handle_t *)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevices[AdapterIndex], &DisplayCount, hDisplayOutput); + LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + printf("Adapter %u:\n", AdapterIndex); + for (uint8_t DisplayIndex = 0; DisplayIndex < DisplayCount; DisplayIndex++) + { + ctl_display_properties_t stDisplayProperties = {}; + stDisplayProperties.Size = sizeof(ctl_display_properties_t); + + if (NULL == hDisplayOutput[DisplayIndex]) + { + printf("\thDisplayOutput[%d] is NULL.\n", DisplayIndex); + Result = CTL_RESULT_ERROR_INVALID_NULL_HANDLE; + EXIT_ON_ERROR(Result); + } + + Result = ctlGetDisplayProperties(hDisplayOutput[DisplayIndex], &stDisplayProperties); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetDisplayProperties"); + + ctl_adapter_display_encoder_properties_t stDisplayEncoderProperties = {}; + stDisplayEncoderProperties.Size = sizeof(ctl_adapter_display_encoder_properties_t); + + Result = ctlGetAdaperDisplayEncoderProperties(hDisplayOutput[DisplayIndex], &stDisplayEncoderProperties); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetAdaperDisplayEncoderProperties"); + + IsDisplayActive = stDisplayProperties.DisplayConfigFlags & CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ACTIVE; + IsDisplayAttached = stDisplayProperties.DisplayConfigFlags & CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ATTACHED; + + memset(&VblankTsArgs, 0, sizeof(ctl_vblank_ts_args_t)); + + // Filter active display outputs + if (IsDisplayActive && IsDisplayAttached) + { + // get genlock status (vblank time stamp) + Result = ctlGetVblankTimestamp(hDisplayOutput[DisplayIndex], &VblankTsArgs); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetVblankTimestamp"); + } + + for (uint8_t i = 0; i < VblankTsArgs.NumOfTargets; i++) + { + printf("\tTarget ID: %d Child[%d] vblank timestamp: %I64d\n", stDisplayProperties.Os_display_encoder_handle.WindowsDisplayEncoderID, i, VblankTsArgs.VblankTS[i]); + } + } + + // Free dynamically allocated memories + CTL_FREE_MEM(hDisplayOutput); + } + +Exit: + CTL_FREE_MEM(hDisplayOutput); + + return Result; +} + /*************************************************************** * @brief FindBestCommonTiming * Find best common target mode timing and fill it to CommonTargetMode @@ -591,11 +690,13 @@ ctl_result_t InitGenlockArgs(ctl_device_adapter_handle_t *hDevices, uint32_t Ada pGenlockArgs[AdapterIndex].GenlockTopology.IsPrimaryGenlockSystem = GenlockSampleArgs.IsGenlockPrimary; // Allocate dynamic memories + CTL_FREE_MEM(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo); pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo = (ctl_genlock_display_info_t *)malloc(sizeof(ctl_genlock_display_info_t) * pGenlockArgs[AdapterIndex].GenlockTopology.NumGenlockDisplays); EXIT_ON_MEM_ALLOC_FAILURE(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo, "pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo"); memset(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo, 0, sizeof(ctl_genlock_display_info_t) * pGenlockArgs[AdapterIndex].GenlockTopology.NumGenlockDisplays); + CTL_FREE_MEM(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockModeList); pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockModeList = (ctl_genlock_target_mode_list_t *)malloc(sizeof(ctl_genlock_target_mode_list_t) * pGenlockArgs[AdapterIndex].GenlockTopology.NumGenlockDisplays); EXIT_ON_MEM_ALLOC_FAILURE(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockModeList, "pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockModeList"); @@ -621,97 +722,191 @@ ctl_result_t InitGenlockArgs(ctl_device_adapter_handle_t *hDevices, uint32_t Ada } /*************************************************************** - * @brief GetVblankTimestamp - * get vblank time stamp - * @param hDevices, AdapterCount + * @brief GenlockEnable + * Enable Display Genlock + * @param hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs * @return ctl_result_t ***************************************************************/ -ctl_result_t GetVblankTimestamp(ctl_device_adapter_handle_t *hDevices, uint32_t AdapterCount) +ctl_result_t GenlockEnable(ctl_device_adapter_handle_t *hDevices, uint32_t AdapterCount, genlock_sample_args GenlockSampleArgs, ctl_genlock_args_t *pGenlockArgs) { - ctl_result_t Result = CTL_RESULT_SUCCESS; - ctl_device_adapter_handle_t hFailureDeviceAdapter = NULL; - ctl_display_output_handle_t *hDisplayOutput = NULL; - ctl_display_output_handle_t *hActiveDisplayOutputs = NULL; - uint32_t DisplayCount = 0; - uint8_t ActiveDisplayCount = 0; - uint8_t MaxNumDisplayOutputs = 0; - bool IsDisplayActive = false; - bool IsDisplayAttached = false; - ctl_vblank_ts_args_t VblankTsArgs; + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_device_adapter_handle_t PrimaryAdapter = NULL; + ctl_device_adapter_handle_t *hSecondaryAdapters = NULL; + uint8_t PrimaryAdapterCount = 0; + uint8_t SecondaryAdapterCount = 0; + uint8_t SecondaryAdapterIndex = 0; - for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) + // The primary adapter must be enabled before enabling other secondary adapters + // Number of primary adapters should be one. Other adapters are configured as a secondary + if (true == GenlockSampleArgs.IsGenlockPrimary) { - ActiveDisplayCount = 0; + PrimaryAdapterCount = NUMBER_OF_PRIMARY_ADAPTERS; + SecondaryAdapterCount = AdapterCount - PrimaryAdapterCount; + hSecondaryAdapters = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * SecondaryAdapterCount); + for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) + { + LUID deviceID; + ctl_device_adapter_properties_t stdeviceAdapterProperties = { 0 }; - // Enumerate all the possible target displays for the adapters - // First step is to get the count - DisplayCount = 0; + stdeviceAdapterProperties.Size = sizeof(ctl_device_adapter_properties_t); + stdeviceAdapterProperties.pDeviceID = &deviceID; + stdeviceAdapterProperties.device_id_size = sizeof(LUID); + stdeviceAdapterProperties.Version = 2; - Result = ctlEnumerateDisplayOutputs(hDevices[AdapterIndex], &DisplayCount, NULL); + // Fetch device adapter properties into stdeviceAdapterProperties + Result = ctlGetDeviceProperties(hDevices[AdapterIndex], &stdeviceAdapterProperties); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetDeviceProperties"); - if (CTL_RESULT_SUCCESS != Result) - { - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); - } - else if (DisplayCount <= 0) - { - printf("Invalid Display Count. Skipping display enumeration for adapter: %d\n", AdapterIndex); - continue; + if (((GenlockSampleArgs.PrimaryBusId != 0) && (stdeviceAdapterProperties.adapter_bdf.bus == GenlockSampleArgs.PrimaryBusId)) || + ((GenlockSampleArgs.PrimaryBusId == 0) && (AdapterIndex == 0))) + { + PrimaryAdapter = hDevices[AdapterIndex]; + } + else + { + hSecondaryAdapters[SecondaryAdapterIndex] = hDevices[AdapterIndex]; + SecondaryAdapterIndex++; + } } - hDisplayOutput = (ctl_display_output_handle_t *)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); - EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + // Enabling a primary adapter + Result = InitGenlockArgs(&PrimaryAdapter, PrimaryAdapterCount, GenlockSampleArgs, pGenlockArgs); + LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs for a primary adapter"); - Result = ctlEnumerateDisplayOutputs(hDevices[AdapterIndex], &DisplayCount, hDisplayOutput); - LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + Result = TestGenlockEnable(&PrimaryAdapter, pGenlockArgs, PrimaryAdapterCount); + LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockEnable - Primary"); - printf("Adapter %u:\n", AdapterIndex); - for (uint8_t DisplayIndex = 0; DisplayIndex < DisplayCount; DisplayIndex++) - { - ctl_display_properties_t stDisplayProperties = {}; - stDisplayProperties.Size = sizeof(ctl_display_properties_t); + // Enabling secondary adapters + GenlockSampleArgs.IsGenlockPrimary = false; + Result = InitGenlockArgs(hSecondaryAdapters, SecondaryAdapterCount, GenlockSampleArgs, pGenlockArgs); + LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs for secondary adapters"); - if (NULL == hDisplayOutput[DisplayIndex]) - { - printf("\thDisplayOutput[%d] is NULL.\n", DisplayIndex); - Result = CTL_RESULT_ERROR_INVALID_NULL_HANDLE; - EXIT_ON_ERROR(Result); - } + Result = TestGenlockEnable(hSecondaryAdapters, pGenlockArgs, SecondaryAdapterCount); + LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockEnable - Secondary"); + } + else + { + // Configuring all adapters as a secondary + Result = InitGenlockArgs(hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs); + LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); + Result = TestGenlockEnable(hDevices, pGenlockArgs, AdapterCount); + LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockEnable - Secondary Adapters"); + } - Result = ctlGetDisplayProperties(hDisplayOutput[DisplayIndex], &stDisplayProperties); - LOG_AND_EXIT_ON_ERROR(Result, "ctlGetDisplayProperties"); +Exit: + CTL_FREE_MEM(hSecondaryAdapters); - ctl_adapter_display_encoder_properties_t stDisplayEncoderProperties = {}; - stDisplayEncoderProperties.Size = sizeof(ctl_adapter_display_encoder_properties_t); + return Result; +} - Result = ctlGetAdaperDisplayEncoderProperties(hDisplayOutput[DisplayIndex], &stDisplayEncoderProperties); - LOG_AND_EXIT_ON_ERROR(Result, "ctlGetAdaperDisplayEncoderProperties"); +/*************************************************************** + * @brief GenlockDisable + * Disable Display Genlock + * @param hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs + * @return ctl_result_t + ***************************************************************/ +ctl_result_t GenlockDisable(ctl_device_adapter_handle_t *hDevices, uint32_t AdapterCount, genlock_sample_args GenlockSampleArgs, ctl_genlock_args_t *pGenlockArgs) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_device_adapter_handle_t *hPrimaryAdapters = NULL; + ctl_device_adapter_handle_t *hSecondaryAdapters = NULL; + uint8_t GenlockedAdapterCount = 0; + uint8_t PrimaryAdapterCount = 0; + uint8_t SecondaryAdapterCount = 0; - IsDisplayActive = stDisplayProperties.DisplayConfigFlags & CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ACTIVE; - IsDisplayAttached = stDisplayProperties.DisplayConfigFlags & CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ATTACHED; + // The primary adapter must be disabled last after secondary adapters are disabled + if (true == GenlockSampleArgs.IsGenlockPrimary) + { + // Secondary adapters should be disabled firstly + // Get topology to check which adapter is a primary + GenlockSampleArgs.Operation = CTL_GENLOCK_OPERATION_GET_TOPOLOGY; + Result = InitGenlockArgs(hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs); + LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); + Result = TestGenlockGetTopology(hDevices, pGenlockArgs, AdapterCount); + LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockGetTopology"); + + // Count primary and secondary adapters + GenlockedAdapterCount = 0; + PrimaryAdapterCount = 0; + SecondaryAdapterCount = 0; + for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) + { + if (true == pGenlockArgs[AdapterIndex].IsGenlockEnabled) + { + GenlockedAdapterCount++; + if (false == pGenlockArgs[AdapterIndex].GenlockTopology.IsPrimaryGenlockSystem) + { + SecondaryAdapterCount++; + } + } + } - memset(&VblankTsArgs, 0, sizeof(ctl_vblank_ts_args_t)); + if (0 == GenlockedAdapterCount) + { + printf("There is no Genlocked adapter.\n"); + Result = CTL_RESULT_ERROR_NOT_INITIALIZED; + EXIT_ON_ERROR(Result); + } - // Filter active display outputs - if (IsDisplayActive && IsDisplayAttached) + PrimaryAdapterCount = GenlockedAdapterCount - SecondaryAdapterCount; + if (0 != PrimaryAdapterCount) + { + hPrimaryAdapters = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * PrimaryAdapterCount); + EXIT_ON_MEM_ALLOC_FAILURE(hPrimaryAdapters, "hPrimaryAdapters"); + } + if (0 != SecondaryAdapterCount) + { + hSecondaryAdapters = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * SecondaryAdapterCount); + EXIT_ON_MEM_ALLOC_FAILURE(hSecondaryAdapters, "hSecondaryAdapters"); + } + + PrimaryAdapterCount = 0; + SecondaryAdapterCount = 0; + for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) + { + if ((true == pGenlockArgs[AdapterIndex].IsGenlockEnabled) && (true == pGenlockArgs[AdapterIndex].GenlockTopology.IsPrimaryGenlockSystem) && (NULL != hPrimaryAdapters)) { - // get genlock status (vblank time stamp) - Result = ctlGetVblankTimestamp(hDisplayOutput[DisplayIndex], &VblankTsArgs); - LOG_AND_EXIT_ON_ERROR(Result, "ctlGetVblankTimestamp"); + hPrimaryAdapters[PrimaryAdapterCount++] = hDevices[AdapterIndex]; } - - for (uint8_t i = 0; i < VblankTsArgs.NumOfTargets; i++) + else if ((true == pGenlockArgs[AdapterIndex].IsGenlockEnabled) && (false == pGenlockArgs[AdapterIndex].GenlockTopology.IsPrimaryGenlockSystem) && (NULL != hSecondaryAdapters)) { - printf("\tTarget ID: %d Child[%d] vblank timestamp: %I64d\n", stDisplayProperties.Os_display_encoder_handle.WindowsDisplayEncoderID, i, VblankTsArgs.VblankTS[i]); + hSecondaryAdapters[SecondaryAdapterCount++] = hDevices[AdapterIndex]; } } - // Free dynamically allocated memories - CTL_FREE_MEM(hDisplayOutput); + GenlockSampleArgs.Operation = CTL_GENLOCK_OPERATION_DISABLE; + // Disable secondary adapters + GenlockSampleArgs.IsGenlockPrimary = false; + if (0 < SecondaryAdapterCount) + { + Result = InitGenlockArgs(hSecondaryAdapters, SecondaryAdapterCount, GenlockSampleArgs, pGenlockArgs); + LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); + Result = TestGenlockDisable(hSecondaryAdapters, pGenlockArgs, SecondaryAdapterCount); + LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockDisable"); + } + CTL_FREE_MEM(hSecondaryAdapters); + + // Disable primary adapter + GenlockSampleArgs.IsGenlockPrimary = true; + if (0 < PrimaryAdapterCount) + { + Result = InitGenlockArgs(hPrimaryAdapters, PrimaryAdapterCount, GenlockSampleArgs, pGenlockArgs); + LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); + Result = TestGenlockDisable(hPrimaryAdapters, pGenlockArgs, PrimaryAdapterCount); + } + + CTL_FREE_MEM(hPrimaryAdapters); + } + else + { + Result = InitGenlockArgs(hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs); + LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); + Result = TestGenlockDisable(hDevices, pGenlockArgs, AdapterCount); } Exit: - CTL_FREE_MEM(hDisplayOutput); + CTL_FREE_MEM(hPrimaryAdapters); + CTL_FREE_MEM(hSecondaryAdapters); return Result; } @@ -724,13 +919,8 @@ ctl_result_t GetVblankTimestamp(ctl_device_adapter_handle_t *hDevices, uint32_t ***************************************************************/ ctl_result_t TestDisplayGenlock(ctl_device_adapter_handle_t *hDevices, uint32_t AdapterCount, genlock_sample_args GenlockSampleArgs) { - ctl_result_t Result = CTL_RESULT_SUCCESS; - ctl_genlock_args_t *pGenlockArgs = NULL; - ctl_device_adapter_handle_t *hPrimaryAdapters = NULL; - ctl_device_adapter_handle_t *hSecondaryAdapters = NULL; - uint8_t GenlockedAdapterCount = 0; - uint8_t PrimaryAdapterCount = 0; - uint8_t SecondaryAdapterCount = 0; + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_genlock_args_t *pGenlockArgs = NULL; pGenlockArgs = (ctl_genlock_args_t *)malloc(sizeof(ctl_genlock_args_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(pGenlockArgs, "pGenlockArgs"); @@ -748,131 +938,10 @@ ctl_result_t TestDisplayGenlock(ctl_device_adapter_handle_t *hDevices, uint32_t Result = TestGenlockValidate(hDevices, pGenlockArgs, AdapterCount); break; case CTL_GENLOCK_OPERATION_ENABLE: - // The primary adapter must be enabled first before other secondary adapters are enabled - if (true == GenlockSampleArgs.IsGenlockPrimary) - { - // Number of primary adapters cannot be zero or bigger than plugged-in adapters count - if ((0 == GenlockSampleArgs.NumberOfPrimaryAdapters) || (AdapterCount < GenlockSampleArgs.NumberOfPrimaryAdapters)) - { - printf("Number of primary adapters cannot be zero or bigger than plugged-in adapters count.\n"); - Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; - CTL_FREE_MEM(pGenlockArgs); - return Result; - } - // Enable primary target on the primary adapter#0 - Result = InitGenlockArgs(hDevices, GenlockSampleArgs.NumberOfPrimaryAdapters, GenlockSampleArgs, pGenlockArgs); - LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); - - Result = TestGenlockEnable(hDevices, pGenlockArgs, GenlockSampleArgs.NumberOfPrimaryAdapters); - LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockEnable - Primary"); - - SecondaryAdapterCount = AdapterCount - GenlockSampleArgs.NumberOfPrimaryAdapters; - if (SecondaryAdapterCount > 0) - { - // Other adapters are secondary systems for Genlock - GenlockSampleArgs.IsGenlockPrimary = false; - Result = InitGenlockArgs(&hDevices[GenlockSampleArgs.NumberOfPrimaryAdapters], SecondaryAdapterCount, GenlockSampleArgs, pGenlockArgs); - LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); - Result = TestGenlockEnable(&hDevices[GenlockSampleArgs.NumberOfPrimaryAdapters], pGenlockArgs, SecondaryAdapterCount); - LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockEnable - Secondary"); - } - } - else - { - Result = InitGenlockArgs(hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs); - LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); - Result = TestGenlockEnable(hDevices, pGenlockArgs, AdapterCount); - LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockEnable - Primary"); - } + Result = GenlockEnable(hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs); break; case CTL_GENLOCK_OPERATION_DISABLE: - // The primary adapter must be disabled last after secondary adapters are disabled - if (true == GenlockSampleArgs.IsGenlockPrimary) - { - // Secondary adapters should be disabled first - // Get topology to check which adapter is a primary - GenlockSampleArgs.Operation = CTL_GENLOCK_OPERATION_GET_TOPOLOGY; - Result = InitGenlockArgs(hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs); - LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); - Result = TestGenlockGetTopology(hDevices, pGenlockArgs, AdapterCount); - LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockGetTopology"); - - // Count primary and secondary adapters - GenlockedAdapterCount = 0; - PrimaryAdapterCount = 0; - SecondaryAdapterCount = 0; - for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) - { - if (true == pGenlockArgs[AdapterIndex].IsGenlockEnabled) - { - GenlockedAdapterCount++; - if (false == pGenlockArgs[AdapterIndex].GenlockTopology.IsPrimaryGenlockSystem) - { - SecondaryAdapterCount++; - } - } - } - - if (0 == GenlockedAdapterCount) - { - printf("There is no Genlocked adapter.\n"); - Result = CTL_RESULT_ERROR_NOT_INITIALIZED; - EXIT_ON_ERROR(Result); - } - - PrimaryAdapterCount = GenlockedAdapterCount - SecondaryAdapterCount; - if (0 != PrimaryAdapterCount) - { - hPrimaryAdapters = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * PrimaryAdapterCount); - EXIT_ON_MEM_ALLOC_FAILURE(hPrimaryAdapters, "hPrimaryAdapters"); - } - if (0 != SecondaryAdapterCount) - { - hSecondaryAdapters = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * SecondaryAdapterCount); - EXIT_ON_MEM_ALLOC_FAILURE(hSecondaryAdapters, "hSecondaryAdapters"); - } - - PrimaryAdapterCount = 0; - SecondaryAdapterCount = 0; - for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) - { - if ((true == pGenlockArgs[AdapterIndex].IsGenlockEnabled) && (true == pGenlockArgs[AdapterIndex].GenlockTopology.IsPrimaryGenlockSystem) && (NULL != hPrimaryAdapters)) - { - hPrimaryAdapters[PrimaryAdapterCount++] = hDevices[AdapterIndex]; - } - else if ((true == pGenlockArgs[AdapterIndex].IsGenlockEnabled) && (false == pGenlockArgs[AdapterIndex].GenlockTopology.IsPrimaryGenlockSystem) && (NULL != hSecondaryAdapters)) - { - hSecondaryAdapters[SecondaryAdapterCount++] = hDevices[AdapterIndex]; - } - } - - GenlockSampleArgs.Operation = CTL_GENLOCK_OPERATION_DISABLE; - // Disable secondary adapters - GenlockSampleArgs.IsGenlockPrimary = false; - if (0 < SecondaryAdapterCount) - { - Result = InitGenlockArgs(hSecondaryAdapters, SecondaryAdapterCount, GenlockSampleArgs, pGenlockArgs); - LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); - Result = TestGenlockDisable(hSecondaryAdapters, pGenlockArgs, SecondaryAdapterCount); - LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockDisable"); - } - CTL_FREE_MEM(hSecondaryAdapters); - - // Disable primary adapter - GenlockSampleArgs.IsGenlockPrimary = true; - if (0 < PrimaryAdapterCount) - { - Result = InitGenlockArgs(hPrimaryAdapters, PrimaryAdapterCount, GenlockSampleArgs, pGenlockArgs); - LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); - Result = TestGenlockDisable(hPrimaryAdapters, pGenlockArgs, PrimaryAdapterCount); - } - } - else - { - Result = InitGenlockArgs(hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs); - LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs"); - Result = TestGenlockDisable(hDevices, pGenlockArgs, AdapterCount); - } + Result = GenlockDisable(hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs); break; case CTL_GENLOCK_OPERATION_GET_TOPOLOGY: Result = InitGenlockArgs(hDevices, AdapterCount, GenlockSampleArgs, pGenlockArgs); @@ -899,8 +968,12 @@ ctl_result_t TestDisplayGenlock(ctl_device_adapter_handle_t *hDevices, uint32_t CTL_FREE_MEM(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockModeList[ModeListIndex].pTargetModes); } } - CTL_FREE_MEM(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo); - CTL_FREE_MEM(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockModeList); + + for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) + { + CTL_FREE_MEM(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo); + CTL_FREE_MEM(pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockModeList); + } } } @@ -934,19 +1007,40 @@ int main(int Argc, char *pArgv[]) CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, NULL); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, NULL); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (true == IsGetVBlankTs) { diff --git a/Samples/DynamicContrastEnhancement_Sample/DynamicContrastEnhancement_Sample_App.cpp b/Samples/DynamicContrastEnhancement_Sample/DynamicContrastEnhancement_Sample_App.cpp index 4ef5ad2..93fe746 100644 --- a/Samples/DynamicContrastEnhancement_Sample/DynamicContrastEnhancement_Sample_App.cpp +++ b/Samples/DynamicContrastEnhancement_Sample/DynamicContrastEnhancement_Sample_App.cpp @@ -266,7 +266,10 @@ double CalculateAverageLuminance(const ctl_dce_args_t DceArgs) TotalLuminance += (double)DceArgs.pHistogram[Index] * DeGammaLUT; } - AverageLuminance = (TotalLuminance / TotalNumPixels) * BLC_PWM_LOW_PRECISION_FACTOR; + if (0 != TotalNumPixels) + { + AverageLuminance = (TotalLuminance / TotalNumPixels) * BLC_PWM_LOW_PRECISION_FACTOR; + } return AverageLuminance; } @@ -432,19 +435,40 @@ int main(int argc, char *pArgv[]) CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, NULL); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, NULL); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Result = TestDynamicContrastEnhancement(hDevices, AdapterCount); LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "TestDynamicContrastEnhancement"); diff --git a/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp b/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp index d8ed5e7..d50d0b6 100644 --- a/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp +++ b/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp @@ -638,8 +638,15 @@ int main(int32_t Argc, char *pArgv[]) CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Get a handle to the DLL module. uint32_t AdapterCount = 0; @@ -757,24 +764,31 @@ int main(int32_t Argc, char *pArgv[]) printf("Info: Ignoring read of binary file for Unlock operation.\n"); break; default: - ifstream EdidFile; - streampos FileSize; - - EdidFile.open(OptionArg, ios::in | ios::binary | ios::ate); - - if (false == EdidFile.is_open()) + try { - printf("Cannot open a EDID file.\n"); - Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; - EXIT_ON_ERROR(Result); + ifstream EdidFile; + streampos FileSize; + + EdidFile.open(OptionArg, ios::in | ios::binary | ios::ate); + + if (false == EdidFile.is_open()) + { + printf("Cannot open a EDID file.\n"); + Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; + EXIT_ON_ERROR(Result); + } + + FileSize = EdidFile.tellg(); + ZeroMemory(&EdidOverrideBuf, sizeof(EdidOverrideBuf)); + EdidFile.seekg(0, ios::beg); + EdidFile.read((char *)&EdidOverrideBuf, FileSize); + EdidFile.close(); + IsCustomEdid = true; + } + catch (const std::ios_base::failure &e) + { + printf("%s \n", e.what()); } - - FileSize = EdidFile.tellg(); - ZeroMemory(&EdidOverrideBuf, sizeof(EdidOverrideBuf)); - EdidFile.seekg(0, ios::beg); - EdidFile.read((char *)&EdidOverrideBuf, FileSize); - EdidFile.close(); - IsCustomEdid = true; break; } } @@ -788,14 +802,28 @@ int main(int32_t Argc, char *pArgv[]) // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Result = EnumerateTargetDisplays(AdapterCount, hDevices); diff --git a/Samples/Generic_Sample/Sample_ControlAPP.cpp b/Samples/Generic_Sample/Sample_ControlAPP.cpp index 55cdf2c..e1bfbce 100644 --- a/Samples/Generic_Sample/Sample_ControlAPP.cpp +++ b/Samples/Generic_Sample/Sample_ControlAPP.cpp @@ -179,12 +179,28 @@ ctl_result_t CtlSharpnessTest(ctl_display_output_handle_t hDisplayOutput) } } } - if (Result == CTL_RESULT_SUCCESS && SharpnessCaps.SupportedFilterFlags == CTL_SHARPNESS_FILTER_TYPE_FLAG_NON_ADAPTIVE) // This Check is to be revisited when we have Adaptive Support + if ((Result == CTL_RESULT_SUCCESS) && + ((SharpnessCaps.SupportedFilterFlags == CTL_SHARPNESS_FILTER_TYPE_FLAG_NON_ADAPTIVE) || (SharpnessCaps.SupportedFilterFlags == CTL_SHARPNESS_FILTER_TYPE_FLAG_ADAPTIVE))) { // SetSharpness if (NULL != hDisplayOutput) { - Result = ctlSetCurrentSharpness(hDisplayOutput, &SetSharpness); + if (SharpnessCaps.SupportedFilterFlags == CTL_SHARPNESS_FILTER_TYPE_FLAG_NON_ADAPTIVE) + { + SetSharpness.FilterType = CTL_SHARPNESS_FILTER_TYPE_FLAG_NON_ADAPTIVE; + } + else if (SharpnessCaps.SupportedFilterFlags == CTL_SHARPNESS_FILTER_TYPE_FLAG_ADAPTIVE) + { + SetSharpness.FilterType = CTL_SHARPNESS_FILTER_TYPE_FLAG_ADAPTIVE; + } + else + { + Result = CTL_RESULT_ERROR_INVALID_SHARPNESS_FILTER_FLAG; + printf("Result: 0x%X FilterType %d", Result, SharpnessCaps.SupportedFilterFlags); + return Result; + } + SetSharpness.FilterType = SharpnessCaps.SupportedFilterFlags; + Result = ctlSetCurrentSharpness(hDisplayOutput, &SetSharpness); if (Result != CTL_RESULT_SUCCESS) { @@ -769,6 +785,144 @@ void PrintDetailsFromSysman(ctl_device_adapter_handle_t hDevice) return; } +ctl_result_t CtlAdapterTesting(void) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_device_adapter_handle_t *hDevices = nullptr; + ctl_display_output_handle_t *hDisplayOutput = nullptr; + ctl_device_adapter_properties_t StDeviceAdapterProperties = { 0 }; + + uint32_t Adapter_count = 0; + uint32_t Display_count = 0; + uint32_t Index = 0; + uint32_t Display_index = 0; + + LUID AdapterID; + StDeviceAdapterProperties.Size = sizeof(ctl_device_adapter_properties_t); + StDeviceAdapterProperties.pDeviceID = malloc(sizeof(LUID)); + StDeviceAdapterProperties.device_id_size = sizeof(LUID); + StDeviceAdapterProperties.Version = 2; + + for (Index = 0; Index < Adapter_count; Index++) + { + if (NULL != hDevices[Index]) + { + printf("\n\n*** Testing adapter #%d ***\n", Index); + + Result = ctlGetDeviceProperties(hDevices[Index], &StDeviceAdapterProperties); + + if (CTL_RESULT_ERROR_UNSUPPORTED_VERSION == Result) // reduce version if required & recheck + { + printf("ctlGetDeviceProperties() version mismatch - Reducing version to 0 and retrying\n"); + StDeviceAdapterProperties.Version = 0; + Result = ctlGetDeviceProperties(hDevices[Index], &StDeviceAdapterProperties); + } + + if (Result != CTL_RESULT_SUCCESS) + { + printf("ctlGetDeviceProperties returned failure code: 0x%X\n", Result); + continue; + } + + if (CTL_DEVICE_TYPE_GRAPHICS != StDeviceAdapterProperties.device_type) + { + printf("This is not a Graphics device \n"); + continue; + } + + if (NULL != StDeviceAdapterProperties.pDeviceID) + { + AdapterID = *(reinterpret_cast(StDeviceAdapterProperties.pDeviceID)); + std::cout << "Adapter ID " << AdapterID.LowPart << "\n"; + } + + if (0x8086 != StDeviceAdapterProperties.pci_vendor_id) + continue; + + PrintAdapterProperties(StDeviceAdapterProperties); + + // get max/P0 from L0 & print the same here + try + { + PrintDetailsFromSysman(hDevices[Index]); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + + // enumerate all the possible target display's for the adapters + // first step is to get the count + Display_count = 0; + Result = ctlEnumerateDisplayOutputs(hDevices[Index], &Display_count, hDisplayOutput); + + printf("ctlEnumerateDisplayOutputs returned %d encoders\n", Display_count); + + if (CTL_RESULT_SUCCESS == Result && (Display_count > 0)) + { + hDisplayOutput = (ctl_display_output_handle_t *)malloc(sizeof(ctl_display_output_handle_t) * Display_count); + if (NULL == hDisplayOutput) + { + return CTL_RESULT_ERROR_UNKNOWN; + } + Result = ctlEnumerateDisplayOutputs(hDevices[Index], &Display_count, hDisplayOutput); + } + + if (Result != CTL_RESULT_SUCCESS) + { + printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + STORE_RESET_ERROR(Result); + } + + // get display encoder properties + if (CTL_RESULT_SUCCESS == Result && hDisplayOutput) + { + GetDisplayEncoderPropertiesTest(hDisplayOutput, &Result, Display_count); + } + + // get display properties + if (CTL_RESULT_SUCCESS == Result && hDisplayOutput) + { + GetDisplayPropertiesTest(hDevices, hDisplayOutput, &Result, Index, Display_count); + } + + // Sharpness Test + if (CTL_RESULT_SUCCESS == Result) + { + if (nullptr == hDisplayOutput) + return CTL_RESULT_ERROR_UNKNOWN; + + for (Display_index = 0; Display_index < Display_count; Display_index++) + { + Result = CtlSharpnessTest(hDisplayOutput[Display_index]); + STORE_RESET_ERROR(Result); + } + } + + // get 3D global properties + if (CTL_RESULT_SUCCESS == Result) + { + try + { + Result = CtlGet3DGlobalTest(hDevices[Index]); + STORE_RESET_ERROR(Result); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + } + } + if (hDisplayOutput != nullptr) + { + free(hDisplayOutput); + hDisplayOutput = nullptr; + } + } + + return Result; +} + /*************************************************************** * @brief Main Function * @@ -799,7 +953,15 @@ int main() // Init App UID appropriately ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); - Result = ctlInit(&CtlInitArgs, &hAPIHandle); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { @@ -808,7 +970,15 @@ int main() // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { @@ -817,16 +987,23 @@ int main() { return ERROR; } - Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } if (CTL_RESULT_SUCCESS != Result) { printf("ctlEnumerateDevices returned failure code: 0x%X\n", Result); - goto free_exit; + goto Exit; } printf("ctlEnumerateDevices returned %d adapters\n", Adapter_count); - LUID AdapterID; StDeviceAdapterProperties.Size = sizeof(ctl_device_adapter_properties_t); StDeviceAdapterProperties.pDeviceID = malloc(sizeof(LUID)); StDeviceAdapterProperties.device_id_size = sizeof(LUID); @@ -838,108 +1015,24 @@ int main() } // test an additional caller from same process - CtlTestAdditionalCaller(); - - for (Index = 0; Index < Adapter_count; Index++) + try { - if (NULL != hDevices[Index]) - { - printf("\n\n*** Testing adapter #%d ***\n", Index); - - Result = ctlGetDeviceProperties(hDevices[Index], &StDeviceAdapterProperties); - - if (CTL_RESULT_ERROR_UNSUPPORTED_VERSION == Result) // reduce version if required & recheck - { - printf("ctlGetDeviceProperties() version mismatch - Reducing version to 0 and retrying\n"); - StDeviceAdapterProperties.Version = 0; - Result = ctlGetDeviceProperties(hDevices[Index], &StDeviceAdapterProperties); - } - - if (Result != CTL_RESULT_SUCCESS) - { - printf("ctlGetDeviceProperties returned failure code: 0x%X\n", Result); - continue; - } - - if (CTL_DEVICE_TYPE_GRAPHICS != StDeviceAdapterProperties.device_type) - { - printf("This is not a Graphics device \n"); - continue; - } - - if (NULL != StDeviceAdapterProperties.pDeviceID) - { - AdapterID = *(reinterpret_cast(StDeviceAdapterProperties.pDeviceID)); - std::cout << "Adapter ID " << AdapterID.LowPart << "\n"; - } - - if (0x8086 != StDeviceAdapterProperties.pci_vendor_id) - continue; - - PrintAdapterProperties(StDeviceAdapterProperties); - - // get max/P0 from L0 & print the same here - PrintDetailsFromSysman(hDevices[Index]); - - // enumerate all the possible target display's for the adapters - // first step is to get the count - Display_count = 0; - Result = ctlEnumerateDisplayOutputs(hDevices[Index], &Display_count, hDisplayOutput); - - printf("ctlEnumerateDisplayOutputs returned %d encoders\n", Display_count); - - if (CTL_RESULT_SUCCESS == Result && (Display_count > 0)) - { - hDisplayOutput = (ctl_display_output_handle_t *)malloc(sizeof(ctl_display_output_handle_t) * Display_count); - Result = ctlEnumerateDisplayOutputs(hDevices[Index], &Display_count, hDisplayOutput); - } - - if (Result != CTL_RESULT_SUCCESS) - { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); - STORE_RESET_ERROR(Result); - } - - // get display encoder properties - if (CTL_RESULT_SUCCESS == Result && hDisplayOutput) - { - GetDisplayEncoderPropertiesTest(hDisplayOutput, &Result, Display_count); - } - - // get display properties - if (CTL_RESULT_SUCCESS == Result && hDisplayOutput) - { - GetDisplayPropertiesTest(hDevices, hDisplayOutput, &Result, Index, Display_count); - } - -#ifdef TEST_ENABLE_SETCALLS - // Sharpness Test - if (CTL_RESULT_SUCCESS == Result) - { - if (nullptr == hDisplayOutput) - return ERROR; - - for (Display_index = 0; Display_index < Display_count; Display_index++) - { - Result = CtlSharpnessTest(hDisplayOutput[Display_index]); - STORE_RESET_ERROR(Result); - } - } -#endif + CtlTestAdditionalCaller(); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } - // get 3D global properties - if (CTL_RESULT_SUCCESS == Result) - { - Result = CtlGet3DGlobalTest(hDevices[Index]); - STORE_RESET_ERROR(Result); - } - } - if (hDisplayOutput != nullptr) - { - free(hDisplayOutput); - hDisplayOutput = nullptr; - } + try + { + CtlAdapterTesting(); + } + catch (const std::ios_base::failure &e) + { + printf("%s \n", e.what()); } + #ifdef _ZE_DDI_H // test level0 handle if ((CTL_RESULT_SUCCESS == Result) && (Adapter_count > 0)) @@ -965,7 +1058,7 @@ int main() { STORE_RESET_ERROR(Result); } -free_exit: +Exit: if (NULL != StDeviceAdapterProperties.pDeviceID) { @@ -975,17 +1068,8 @@ int main() ctlClose(hAPIHandle); - if (hDisplayOutput != nullptr) - { - free(hDisplayOutput); - hDisplayOutput = nullptr; - } - - if (hDevices != nullptr) - { - free(hDevices); - hDevices = nullptr; - } + CTL_FREE_MEM(hDisplayOutput); + CTL_FREE_MEM(hDevices); printf("Overrall test result is 0x%X\n", GResult); return GResult; diff --git a/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp b/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp index 98763f5..cac6e38 100644 --- a/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp +++ b/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp @@ -413,19 +413,40 @@ int main() CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Result = EnumerateTargetDisplays(AdapterCount, hDevices); diff --git a/Samples/IntelArcSync/IntelArcSync_App.cpp b/Samples/IntelArcSync/IntelArcSync_App.cpp index 89b46dc..6318a1f 100644 --- a/Samples/IntelArcSync/IntelArcSync_App.cpp +++ b/Samples/IntelArcSync/IntelArcSync_App.cpp @@ -591,11 +591,25 @@ int main(int argc, char *pArgv[]) if ("caps" == SubOption) { - GetIntelArcSyncCaps(); + try + { + GetIntelArcSyncCaps(); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } else if ("profile" == SubOption) { - GetIntelArcSyncProfileDetails(); + try + { + GetIntelArcSyncProfileDetails(); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } else if ("profile-names" == SubOption) { @@ -639,11 +653,25 @@ int main(int argc, char *pArgv[]) sscanf_s(pArgv[5], "%f", &MaxRr); sscanf_s(pArgv[6], "%d", &SfditValue); sscanf_s(pArgv[7], "%d", &SfddtValue); - SetIntelArcSyncProfile(pArgv[3], MinRr, MaxRr, SfditValue, SfddtValue); + try + { + SetIntelArcSyncProfile(pArgv[3], MinRr, MaxRr, SfditValue, SfddtValue); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } else { - SetIntelArcSyncProfile(pArgv[3], 0, 0, 0, 0); + try + { + SetIntelArcSyncProfile(pArgv[3], 0, 0, 0, 0); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } } else diff --git a/Samples/Media_Samples/Media_Sample_App.cpp b/Samples/Media_Samples/Media_Sample_App.cpp index 77d21a1..adb7e61 100644 --- a/Samples/Media_Samples/Media_Sample_App.cpp +++ b/Samples/Media_Samples/Media_Sample_App.cpp @@ -23,6 +23,7 @@ #define CTL_APIEXPORT // caller of control API DLL shall define this before // including igcl_api.h #include "igcl_api.h" +#include "GenericIGCLApp.h" ctl_result_t GResult = CTL_RESULT_SUCCESS; #define STORE_RESET_ERROR(Result) \ @@ -966,14 +967,30 @@ int main() CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); - Result = ctlInit(&CtlInitArgs, &hAPIHandle); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { @@ -981,14 +998,22 @@ int main() if (hDevices == NULL) { GResult = CTL_RESULT_ERROR_INVALID_NULL_POINTER; - goto free_exit; + goto Exit; + } + try + { + Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); } - Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); } if (CTL_RESULT_SUCCESS != Result) { printf("ctlEnumerateDevices returned failure code: 0x%X\n", Result); - goto free_exit; + goto Exit; } for (Index = 0; Index < Adapter_count; Index++) @@ -1028,17 +1053,17 @@ int main() if (NULL != StDeviceAdapterProperties.pDeviceID) { AdapterID = *(reinterpret_cast(StDeviceAdapterProperties.pDeviceID)); - std::cout << "Adapter ID " << AdapterID.LowPart << "\n"; + printf(" Adapter ID %lu\n", AdapterID.LowPart); } if (0x8086 == StDeviceAdapterProperties.pci_vendor_id) { - std::cout << "Intel Adapter Name " << StDeviceAdapterProperties.name << "\n"; - std::cout << "Vendor id " << StDeviceAdapterProperties.pci_vendor_id << "\n"; - std::cout << "Device id " << StDeviceAdapterProperties.pci_device_id << "\n"; - std::cout << "SubSys id " << StDeviceAdapterProperties.pci_subsys_id << "\n"; - std::cout << "SubSys Vendor id " << StDeviceAdapterProperties.pci_subsys_vendor_id << "\n"; - std::cout << "Rev id " << StDeviceAdapterProperties.rev_id << "\n"; + printf(" Intel Adapter Name %s\n", StDeviceAdapterProperties.name); + printf("Vendor id 0x%X\n", StDeviceAdapterProperties.pci_vendor_id); + printf("Device id: 0x%X\n", StDeviceAdapterProperties.pci_device_id); + printf("SubSys id 0x%X\n", StDeviceAdapterProperties.pci_subsys_id); + printf("SubSys Vendor id 0x%X\n", StDeviceAdapterProperties.pci_subsys_vendor_id); + printf("Rev id: 0x%X\n", StDeviceAdapterProperties.rev_id); } // get media properties @@ -1069,7 +1094,7 @@ int main() STORE_RESET_ERROR(Result); } -free_exit: +Exit: ctlClose(hAPIHandle); diff --git a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp index f83a841..848050d 100644 --- a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp +++ b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp @@ -781,13 +781,29 @@ int main() CtlInitArgs.Version = 0; ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); - Result = ctlInit(&CtlInitArgs, &hAPIHandle); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { @@ -798,7 +814,15 @@ int main() goto Exit; } - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } if (CTL_RESULT_SUCCESS != Result) diff --git a/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp b/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp index 71857cd..5fbbe31 100644 --- a/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp +++ b/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp @@ -265,19 +265,40 @@ int main() CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Result = EnumerateTargetDisplays(AdapterCount, hDevices); diff --git a/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp b/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp index 42cb4de..c0da951 100644 --- a/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp +++ b/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp @@ -726,19 +726,40 @@ int main() CtlInitArgs.Version = 0; ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Result = EnumerateTargetDisplays(hDisplayOutput, AdapterCount, hDevices); diff --git a/Samples/Scaling_Samples/Scaling_App.cpp b/Samples/Scaling_Samples/Scaling_App.cpp index 48c1986..969673f 100644 --- a/Samples/Scaling_Samples/Scaling_App.cpp +++ b/Samples/Scaling_Samples/Scaling_App.cpp @@ -194,19 +194,40 @@ int main() CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } for (uint32_t i = 0; i < AdapterCount; i++) { diff --git a/Samples/ScdcRead/ScdcReadApp.cpp b/Samples/ScdcRead/ScdcReadApp.cpp index 9bd980b..899404d 100644 --- a/Samples/ScdcRead/ScdcReadApp.cpp +++ b/Samples/ScdcRead/ScdcReadApp.cpp @@ -180,19 +180,40 @@ int main() CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Result = EnumerateTargetDisplays(AdapterCount, hDevices, &hDisplayOutput, &DisplayCount); diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index ab1aa6a..6a3fa17 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -1473,6 +1473,66 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\n \n"); } +void PerComponentTest(ctl_device_adapter_handle_t hDAhandle) +{ + try + { + CtlPowerTest(hDAhandle); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + try + { + CtlFrequencyTest(hDAhandle); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + try + { + CtlEngineTest(hDAhandle); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + try + { + CtlTemperatureTest(hDAhandle); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + try + { + CtlMemoryTest(hDAhandle); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + try + { + CtlPciTest(hDAhandle); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + try + { + CtlFanTest(hDAhandle); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } +} + /*************************************************************** * @brief Main Function * @@ -1500,14 +1560,30 @@ int main() CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); - Result = ctlInit(&CtlInitArgs, &hAPIHandle); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } if (CTL_RESULT_SUCCESS == Result) { @@ -1516,12 +1592,20 @@ int main() { return ERROR; } - Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &Adapter_count, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } if (CTL_RESULT_SUCCESS != Result) { printf("ctlEnumerateDevices returned failure code: 0x%X\n", Result); - goto free_exit; + goto Exit; } for (Index = 0; Index < Adapter_count; Index++) @@ -1575,13 +1659,7 @@ int main() } // Per Component Tests - CtlPowerTest(hDevices[Index]); - CtlFrequencyTest(hDevices[Index]); - CtlEngineTest(hDevices[Index]); - CtlTemperatureTest(hDevices[Index]); - CtlMemoryTest(hDevices[Index]); - CtlPciTest(hDevices[Index]); - CtlFanTest(hDevices[Index]); + PerComponentTest(hDevices[Index]); // Overclocking Test CtlOverclockPropertiesTest(hDevices[Index]); @@ -1622,7 +1700,7 @@ int main() } } -free_exit: +Exit: ctlClose(hAPIHandle); diff --git a/Samples/UBRR_Sample/UBRR_Sample_App.cpp b/Samples/UBRR_Sample/UBRR_Sample_App.cpp index ba2c3a6..f8a1d90 100644 --- a/Samples/UBRR_Sample/UBRR_Sample_App.cpp +++ b/Samples/UBRR_Sample/UBRR_Sample_App.cpp @@ -170,19 +170,40 @@ int main() CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; - Result = ctlInit(&CtlInitArgs, &hAPIHandle); - LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } // Initialization successful // Get the list of Intel Adapters - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); - Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); - LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Result = EnumerateTargetDisplays(AdapterCount, hDevices); diff --git a/includes/igcl_api.h b/includes/igcl_api.h index ff83226..9b0460d 100644 --- a/includes/igcl_api.h +++ b/includes/igcl_api.h @@ -1229,6 +1229,14 @@ typedef struct _ctl_lda_args_t ctl_lda_args_t; /// @brief Forward-declare ctl_dce_args_t typedef struct _ctl_dce_args_t ctl_dce_args_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_wire_format_t +typedef struct _ctl_wire_format_t ctl_wire_format_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_get_set_wire_format_config_t +typedef struct _ctl_get_set_wire_format_config_t ctl_get_set_wire_format_config_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ctl_engine_properties_t typedef struct _ctl_engine_properties_t ctl_engine_properties_t; @@ -4398,6 +4406,86 @@ ctlGetSetDynamicContrastEnhancement( ctl_dce_args_t* pDceArgs ///< [in,out] Dynamic Contrast Enhancement arguments ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Color model +typedef enum _ctl_wire_format_color_model_t +{ + CTL_WIRE_FORMAT_COLOR_MODEL_RGB = 0, ///< Color model RGB + CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_420 = 1, ///< Color model YCBCR 420 + CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_422 = 2, ///< Color model YCBCR 422 + CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_444 = 3, ///< Color model YCBCR 444 + CTL_WIRE_FORMAT_COLOR_MODEL_MAX + +} ctl_wire_format_color_model_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Operation type +typedef enum _ctl_wire_format_operation_type_t +{ + CTL_WIRE_FORMAT_OPERATION_TYPE_GET = 0, ///< Get request + CTL_WIRE_FORMAT_OPERATION_TYPE_SET = 1, ///< Set request + CTL_WIRE_FORMAT_OPERATION_TYPE_RESTORE_DEFAULT = 2, ///< Restore to default values + CTL_WIRE_FORMAT_OPERATION_TYPE_MAX + +} ctl_wire_format_operation_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Wire Format +typedef struct _ctl_wire_format_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_wire_format_color_model_t ColorModel; ///< [in,out] Color model + ctl_output_bpc_flags_t ColorDepth; ///< [in,out] Color Depth + +} ctl_wire_format_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED +/// @brief Maximum Wire Formats Supported +#define CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED 4 +#endif // CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Set Wire Format +typedef struct _ctl_get_set_wire_format_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_wire_format_operation_type_t Operation; ///< [in] Get/Set Operation + ctl_wire_format_t SupportedWireFormat[CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED]; ///< [out] Array of WireFormats supported + ctl_wire_format_t WireFormat; ///< [in,out] Current/Requested WireFormat based on Operation. During SET + ///< Operation, if multiple bpc is set, the MIN bpc will be applied + +} ctl_get_set_wire_format_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Color Format and Color Depth +/// +/// @details +/// - Get and Set the Color Format and Color Depth of a target +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pGetSetWireFormatSetting` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid data passed as argument, WireFormat is not supported" +/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetWireFormat( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_get_set_wire_format_config_t* pGetSetWireFormatSetting ///< [in][release] Get/Set Wire Format settings to be fetched/applied + ); + #if !defined(__GNUC__) #pragma endregion // display @@ -7229,6 +7317,14 @@ typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDynamicContrastEnhancement_t)( ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetWireFormat +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetWireFormat_t)( + ctl_display_output_handle_t, + ctl_get_set_wire_format_config_t* + ); + + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for ctlEnumEngineGroups typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumEngineGroups_t)( diff --git a/wrapper/cApiWrapper.cpp b/wrapper/cApiWrapper.cpp index 043b792..ef672cd 100644 --- a/wrapper/cApiWrapper.cpp +++ b/wrapper/cApiWrapper.cpp @@ -2292,6 +2292,50 @@ ctlGetSetDynamicContrastEnhancement( } +/** +* @brief Get/Set Color Format and Color Depth +* +* @details +* - Get and Set the Color Format and Color Depth of a target +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pGetSetWireFormatSetting` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid data passed as argument, WireFormat is not supported" +* - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +*/ +ctl_result_t CTL_APICALL +ctlGetSetWireFormat( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_get_set_wire_format_config_t* pGetSetWireFormatSetting ///< [in][release] Get/Set Wire Format settings to be fetched/applied + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + if (NULL != hinstLib) + { + ctl_pfnGetSetWireFormat_t pfnGetSetWireFormat = (ctl_pfnGetSetWireFormat_t)GetProcAddress(hinstLib, "ctlGetSetWireFormat"); + if (pfnGetSetWireFormat) + { + result = pfnGetSetWireFormat(hDisplayOutput, pGetSetWireFormatSetting); + } + } + + return result; +} + + /** * @brief Get handle of engine groups * From 19516e5b661020bae051f978f6c06a1bed6dc2f7 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Wed, 28 Feb 2024 21:03:06 +0530 Subject: [PATCH 02/26] Updated version to v184 --- Samples/3D_Feature_Samples/CMakeLists.txt | 4 +- Samples/Color_Samples/CMakeLists.txt | 4 +- Samples/Color_Samples/Color_Sample_App.cpp | 49 ++ Samples/CombinedDisplay/CMakeLists.txt | 4 +- Samples/Custom_Mode_Samples/CMakeLists.txt | 4 +- Samples/DisplayGenlock/CMakeLists.txt | 4 +- .../CMakeLists.txt | 4 +- Samples/Edid_Management_Sample/CMakeLists.txt | 4 +- Samples/Generic_Sample/CMakeLists.txt | 4 +- Samples/I2C_AUX_Samples/CMakeLists.txt | 4 +- Samples/IntelArcSync/CMakeLists.txt | 4 +- Samples/Media_Samples/CMakeLists.txt | 4 +- Samples/Overclocking_Sample/CMakeLists.txt | 4 +- .../Sample_OverclockAPP.cpp | 12 +- .../Panel_descriptor_Samples/CMakeLists.txt | 4 +- Samples/Power_Feature_Samples/CMakeLists.txt | 4 +- Samples/Scaling_Samples/CMakeLists.txt | 4 +- Samples/ScdcRead/CMakeLists.txt | 4 +- Samples/Telemetry_Samples/CMakeLists.txt | 4 +- Samples/UBRR_Sample/CMakeLists.txt | 4 +- includes/igcl_api.h | 161 ++++ wrapper/cApiWrapper.cpp | 693 ++++++++++++------ 22 files changed, 737 insertions(+), 250 deletions(-) diff --git a/Samples/3D_Feature_Samples/CMakeLists.txt b/Samples/3D_Feature_Samples/CMakeLists.txt index 4e0e9f6..d784487 100644 --- a/Samples/3D_Feature_Samples/CMakeLists.txt +++ b/Samples/3D_Feature_Samples/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(3D_Feature_Samples VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/3D_Feature_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Color_Samples/CMakeLists.txt b/Samples/Color_Samples/CMakeLists.txt index 90223f6..811cf47 100644 --- a/Samples/Color_Samples/CMakeLists.txt +++ b/Samples/Color_Samples/CMakeLists.txt @@ -6,7 +6,7 @@ add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/ColorAlgorithms_App.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Color_Sample_App.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ColorAlgorithms_App.h - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -20,5 +20,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Color_Samples/Color_Sample_App.cpp b/Samples/Color_Samples/Color_Sample_App.cpp index 42f34c3..d952301 100644 --- a/Samples/Color_Samples/Color_Sample_App.cpp +++ b/Samples/Color_Samples/Color_Sample_App.cpp @@ -2037,6 +2037,52 @@ ctl_result_t TestLaceGetSetConfigForALS(ctl_display_output_handle_t hDisplayOutp return Result; } +/*************************************************************** + * @brief + * Sample Test To Override Color Model And Color Depth + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestToOverrideColorModelAndColorDepth(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_get_set_wire_format_config_t CurrentWireFormatSetting = { 0 }; + ctl_get_set_wire_format_config_t NewWireFormatSetting = { 0 }; + + // GET call + CurrentWireFormatSetting.Size = sizeof(ctl_get_set_wire_format_config_t); + CurrentWireFormatSetting.Operation = CTL_WIRE_FORMAT_OPERATION_TYPE_GET; + Result = ctlGetSetWireFormat(hDisplayOutput, &CurrentWireFormatSetting); + LOG_AND_EXIT_ON_ERROR(Result, "GET Call using ctlGetSetWireFormat"); + + printf("Current ColorModel %d", CurrentWireFormatSetting.WireFormat.ColorModel); + printf("Current ColorDepth %d", CurrentWireFormatSetting.WireFormat.ColorDepth); + + for (uint32_t Index = 0; Index < CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED; Index++) + { + printf("Supported ColorModel %d", CurrentWireFormatSetting.SupportedWireFormat[Index].ColorModel); + printf("Supported ColorDepth %d", CurrentWireFormatSetting.SupportedWireFormat[Index].ColorDepth); + } + + // SET call + NewWireFormatSetting.Size = sizeof(ctl_get_set_wire_format_config_t); + NewWireFormatSetting.Operation = CTL_WIRE_FORMAT_OPERATION_TYPE_SET; + NewWireFormatSetting.WireFormat.ColorModel = CTL_WIRE_FORMAT_COLOR_MODEL_RGB; + NewWireFormatSetting.WireFormat.ColorDepth = CTL_OUTPUT_BPC_FLAG_8BPC; + + Result = ctlGetSetWireFormat(hDisplayOutput, &NewWireFormatSetting); + LOG_AND_EXIT_ON_ERROR(Result, "SET Call using ctlGetSetWireFormat"); + + // Restore to default + NewWireFormatSetting.Size = sizeof(ctl_get_set_wire_format_config_t); + NewWireFormatSetting.Operation = CTL_WIRE_FORMAT_OPERATION_TYPE_RESTORE_DEFAULT; + Result = ctlGetSetWireFormat(hDisplayOutput, &NewWireFormatSetting); + LOG_AND_EXIT_ON_ERROR(Result, "RESTORE DEFAULT Call using ctlGetSetWireFormat"); + +Exit: + return Result; +} + /*************************************************************** * @brief TestColorForEnumDisplayHandles * Only for demonstration purpose, API is called for each of the display output handle in below snippet. @@ -2073,6 +2119,9 @@ ctl_result_t TestColorForEnumDisplayHandles(ctl_display_output_handle_t *hDispla Result = TestLaceGetSetConfigForALS(hDisplayOutput[DisplayIndex]); STORE_AND_RESET_ERROR(Result); + + Result = TestToOverrideColorModelAndColorDepth(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); } Exit: diff --git a/Samples/CombinedDisplay/CMakeLists.txt b/Samples/CombinedDisplay/CMakeLists.txt index 0619f00..332cf0f 100644 --- a/Samples/CombinedDisplay/CMakeLists.txt +++ b/Samples/CombinedDisplay/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(CombinedDisplay VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/CombinedDisplay_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Custom_Mode_Samples/CMakeLists.txt b/Samples/Custom_Mode_Samples/CMakeLists.txt index 7b6731d..f38588d 100644 --- a/Samples/Custom_Mode_Samples/CMakeLists.txt +++ b/Samples/Custom_Mode_Samples/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Custom_Mode_Samples VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/CustomMode_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/DisplayGenlock/CMakeLists.txt b/Samples/DisplayGenlock/CMakeLists.txt index 656670f..c6de010 100644 --- a/Samples/DisplayGenlock/CMakeLists.txt +++ b/Samples/DisplayGenlock/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(DisplayGenlock VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/DisplayGenlock_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/DynamicContrastEnhancement_Sample/CMakeLists.txt b/Samples/DynamicContrastEnhancement_Sample/CMakeLists.txt index 6de84c2..7cabf22 100644 --- a/Samples/DynamicContrastEnhancement_Sample/CMakeLists.txt +++ b/Samples/DynamicContrastEnhancement_Sample/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(DynamicContrastEnhancement_Sample VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/DynamicContrastEnhancement_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Edid_Management_Sample/CMakeLists.txt b/Samples/Edid_Management_Sample/CMakeLists.txt index ea9c555..35ad7b8 100644 --- a/Samples/Edid_Management_Sample/CMakeLists.txt +++ b/Samples/Edid_Management_Sample/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Edid_Management_Sample VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/Edid_Mgmt_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Generic_Sample/CMakeLists.txt b/Samples/Generic_Sample/CMakeLists.txt index e6d7644..f8ed9e2 100644 --- a/Samples/Generic_Sample/CMakeLists.txt +++ b/Samples/Generic_Sample/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Generic_Sample VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/Sample_ControlAPP.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/I2C_AUX_Samples/CMakeLists.txt b/Samples/I2C_AUX_Samples/CMakeLists.txt index efce49d..e4a1316 100644 --- a/Samples/I2C_AUX_Samples/CMakeLists.txt +++ b/Samples/I2C_AUX_Samples/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(I2C_AUX_Samples VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/I2C_AUX_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/IntelArcSync/CMakeLists.txt b/Samples/IntelArcSync/CMakeLists.txt index cfdaf48..de6c3fd 100644 --- a/Samples/IntelArcSync/CMakeLists.txt +++ b/Samples/IntelArcSync/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(IntelArcSync VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/IntelArcSync_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Media_Samples/CMakeLists.txt b/Samples/Media_Samples/CMakeLists.txt index 0ecfa82..b163552 100644 --- a/Samples/Media_Samples/CMakeLists.txt +++ b/Samples/Media_Samples/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Media_Samples VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/Media_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Overclocking_Sample/CMakeLists.txt b/Samples/Overclocking_Sample/CMakeLists.txt index 7603ccf..0f10896 100644 --- a/Samples/Overclocking_Sample/CMakeLists.txt +++ b/Samples/Overclocking_Sample/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Overclocking_Sample VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/Sample_OverclockAPP.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp index 848050d..0e9dd0f 100644 --- a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp +++ b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp @@ -352,7 +352,11 @@ void OverclockFrequencyOffset(ctl_device_adapter_handle_t hDAhandle) // Setting the Offset to 0 GPUFrequencyOffset = 0.0; - ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); + Status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + } Exit: return; @@ -415,7 +419,11 @@ void OverclockVoltageOffset(ctl_device_adapter_handle_t hDAhandle) // Setting the Offset to 0 VoltageOffset = 0.0; - ctlOverclockGpuVoltageOffsetSet(hDAhandle, VoltageOffset); + Status = ctlOverclockGpuVoltageOffsetSet(hDAhandle, VoltageOffset); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + } Exit: return; diff --git a/Samples/Panel_descriptor_Samples/CMakeLists.txt b/Samples/Panel_descriptor_Samples/CMakeLists.txt index 1fa2b74..114de0c 100644 --- a/Samples/Panel_descriptor_Samples/CMakeLists.txt +++ b/Samples/Panel_descriptor_Samples/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Panel_descriptor_Samples VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/Panel_descriptor_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Power_Feature_Samples/CMakeLists.txt b/Samples/Power_Feature_Samples/CMakeLists.txt index f2b4642..1fd3ba7 100644 --- a/Samples/Power_Feature_Samples/CMakeLists.txt +++ b/Samples/Power_Feature_Samples/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Power_Feature_Samples VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/PowerFeature_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Scaling_Samples/CMakeLists.txt b/Samples/Scaling_Samples/CMakeLists.txt index cdcce6b..462ed52 100644 --- a/Samples/Scaling_Samples/CMakeLists.txt +++ b/Samples/Scaling_Samples/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Scaling_Samples VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/Scaling_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/ScdcRead/CMakeLists.txt b/Samples/ScdcRead/CMakeLists.txt index 71a199d..05d3fb6 100644 --- a/Samples/ScdcRead/CMakeLists.txt +++ b/Samples/ScdcRead/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(ScdcRead VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/ScdcReadApp.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/Telemetry_Samples/CMakeLists.txt b/Samples/Telemetry_Samples/CMakeLists.txt index 16d6077..0f279f6 100644 --- a/Samples/Telemetry_Samples/CMakeLists.txt +++ b/Samples/Telemetry_Samples/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Telemetry_Samples VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/Sample_TelemetryAPP.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/UBRR_Sample/CMakeLists.txt b/Samples/UBRR_Sample/CMakeLists.txt index 1b661e6..5238e28 100644 --- a/Samples/UBRR_Sample/CMakeLists.txt +++ b/Samples/UBRR_Sample/CMakeLists.txt @@ -4,7 +4,7 @@ get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(UBRR_Sample VERSION 1.0) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/UBRR_Sample_App.cpp - ${ROOT_DIR}/wrapper/cApiWrapper.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp ) if(MSVC) @@ -18,5 +18,5 @@ if(MSVC) ADD_DEFINITIONS(-D_UNICODE) endif() -include_directories(${ROOT_DIR}/includes) +include_directories(${ROOT_DIR}/include) include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/includes/igcl_api.h b/includes/igcl_api.h index 9b0460d..e931d1a 100644 --- a/includes/igcl_api.h +++ b/includes/igcl_api.h @@ -1237,6 +1237,10 @@ typedef struct _ctl_wire_format_t ctl_wire_format_t; /// @brief Forward-declare ctl_get_set_wire_format_config_t typedef struct _ctl_get_set_wire_format_config_t ctl_get_set_wire_format_config_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_display_settings_t +typedef struct _ctl_display_settings_t ctl_display_settings_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ctl_engine_properties_t typedef struct _ctl_engine_properties_t ctl_engine_properties_t; @@ -2037,6 +2041,8 @@ typedef enum _ctl_std_display_feature_flag_t CTL_STD_DISPLAY_FEATURE_FLAG_VESA_COMPRESSION = CTL_BIT(4), ///< [out] Is display compression (VESA DSC) supported CTL_STD_DISPLAY_FEATURE_FLAG_HDR = CTL_BIT(5), ///< [out] Is HDR supported CTL_STD_DISPLAY_FEATURE_FLAG_HDMI_QMS = CTL_BIT(6), ///< [out] Is HDMI QMS supported + CTL_STD_DISPLAY_FEATURE_FLAG_HDR10_PLUS_CERTIFIED = CTL_BIT(7), ///< [out] Is HDR10+ certified + CTL_STD_DISPLAY_FEATURE_FLAG_VESA_HDR_CERTIFIED = CTL_BIT(8), ///< [out] Is VESA HDR certified - for future use CTL_STD_DISPLAY_FEATURE_FLAG_MAX = 0x80000000 } ctl_std_display_feature_flag_t; @@ -2050,6 +2056,7 @@ typedef enum _ctl_intel_display_feature_flag_t CTL_INTEL_DISPLAY_FEATURE_FLAG_DPST = CTL_BIT(0), ///< [out] Is DPST supported CTL_INTEL_DISPLAY_FEATURE_FLAG_LACE = CTL_BIT(1), ///< [out] Is LACE supported CTL_INTEL_DISPLAY_FEATURE_FLAG_DRRS = CTL_BIT(2), ///< [out] Is DRRS supported + CTL_INTEL_DISPLAY_FEATURE_FLAG_ARC_ADAPTIVE_SYNC_CERTIFIED = CTL_BIT(3),///< [out] Is Intel Arc certified adaptive sync display CTL_INTEL_DISPLAY_FEATURE_FLAG_MAX = 0x80000000 } ctl_intel_display_feature_flag_t; @@ -4486,6 +4493,152 @@ ctlGetSetWireFormat( ctl_get_set_wire_format_config_t* pGetSetWireFormatSetting ///< [in][release] Get/Set Wire Format settings to be fetched/applied ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Various display settings +typedef uint32_t ctl_display_setting_flags_t; +typedef enum _ctl_display_setting_flag_t +{ + CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY = CTL_BIT(0), ///< Low latency + CTL_DISPLAY_SETTING_FLAG_SOURCE_TM = CTL_BIT(1),///< Source tone mapping + CTL_DISPLAY_SETTING_FLAG_CONTENT_TYPE = CTL_BIT(2), ///< Content type + CTL_DISPLAY_SETTING_FLAG_QUANTIZATION_RANGE = CTL_BIT(3), ///< Quantization range, full range or limited range + CTL_DISPLAY_SETTING_FLAG_PICTURE_AR = CTL_BIT(4), ///< Picture aspect ratio + CTL_DISPLAY_SETTING_FLAG_AUDIO = CTL_BIT(5), ///< Audio settings + CTL_DISPLAY_SETTING_FLAG_MAX = 0x80000000 + +} ctl_display_setting_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Low latency setting +typedef enum _ctl_display_setting_low_latency_t +{ + CTL_DISPLAY_SETTING_LOW_LATENCY_DEFAULT = 0, ///< Default + CTL_DISPLAY_SETTING_LOW_LATENCY_DISABLED = 1, ///< Disabled + CTL_DISPLAY_SETTING_LOW_LATENCY_ENABLED = 2, ///< Enabled + CTL_DISPLAY_SETTING_LOW_LATENCY_MAX + +} ctl_display_setting_low_latency_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Source tone mapping setting +typedef enum _ctl_display_setting_sourcetm_t +{ + CTL_DISPLAY_SETTING_SOURCETM_DEFAULT = 0, ///< Default + CTL_DISPLAY_SETTING_SOURCETM_DISABLED = 1, ///< Disabled + CTL_DISPLAY_SETTING_SOURCETM_ENABLED = 2, ///< Enabled + CTL_DISPLAY_SETTING_SOURCETM_MAX + +} ctl_display_setting_sourcetm_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Content type settings +typedef enum _ctl_display_setting_content_type_t +{ + CTL_DISPLAY_SETTING_CONTENT_TYPE_DEFAULT = 0, ///< Default content type used by driver. Driver will use internal + ///< techniques to determine content type and indicate to panel + CTL_DISPLAY_SETTING_CONTENT_TYPE_DISABLED = 1, ///< Content type indication is disabled + CTL_DISPLAY_SETTING_CONTENT_TYPE_DESKTOP = 2, ///< Typical desktop with a mix of text and graphics + CTL_DISPLAY_SETTING_CONTENT_TYPE_MEDIA = 3, ///< Video or media content + CTL_DISPLAY_SETTING_CONTENT_TYPE_GAMING = 4, ///< Gaming content + CTL_DISPLAY_SETTING_CONTENT_TYPE_MAX + +} ctl_display_setting_content_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Quantization range +typedef enum _ctl_display_setting_quantization_range_t +{ + CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_DEFAULT = 0, ///< Default based on video format + CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_LIMITED_RANGE = 1, ///< Limited range + CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_FULL_RANGE = 2, ///< Full range + CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_MAX + +} ctl_display_setting_quantization_range_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Picture aspect ratio +typedef uint32_t ctl_display_setting_picture_ar_flags_t; +typedef enum _ctl_display_setting_picture_ar_flag_t +{ + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DEFAULT = CTL_BIT(0), ///< Default picture aspect ratio + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DISABLED = CTL_BIT(1), ///< Picture aspect ratio indication is explicitly disabled + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_4_3 = CTL_BIT(2),///< Aspect ratio of 4:3 + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_16_9 = CTL_BIT(3), ///< Aspect ratio of 16:9 + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_64_27 = CTL_BIT(4), ///< Aspect ratio of 64:27 or 21:9 anamorphic + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_256_135 = CTL_BIT(5),///< Aspect ratio of 256:135 + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_MAX = 0x80000000 + +} ctl_display_setting_picture_ar_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Audio settings +typedef enum _ctl_display_setting_audio_t +{ + CTL_DISPLAY_SETTING_AUDIO_DEFAULT = 0, ///< Default audio settings, always enumerated and enabled if display + ///< supports it + CTL_DISPLAY_SETTING_AUDIO_DISABLED = 1, ///< Forcefully disable display audio end point enumeration to OS + CTL_DISPLAY_SETTING_AUDIO_MAX + +} ctl_display_setting_audio_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set end display settings +typedef struct _ctl_display_settings_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool Set; ///< [in] Flag to indicate Set or Get operation. Default option for all + ///< features are reserved for Set=true calls, which will reset the setting + ///< to driver defaults. + ctl_display_setting_flags_t SupportedFlags; ///< [out] Display setting flags supported by the display. + ctl_display_setting_flags_t ControllableFlags; ///< [out] Display setting flags which can be controlled by the caller. + ///< Features which doesn't have this flag set cannot be changed by caller. + ctl_display_setting_flags_t ValidFlags; ///< [in,out] Display setting flags which caller can use to indicate the + ///< features it's interested in. This cannot have a bit set which is not + ///< supported by SupportedFlags and ControllableFlags. + ctl_display_setting_low_latency_t LowLatency; ///< [in,out] Low latency state of panel. For HDR10+ Gaming this need to be + ///< in ENABLED state. + ctl_display_setting_sourcetm_t SourceTM; ///< [in,out] Source tone mapping state known to panel. For HDR10+ Gaming + ///< this need to be in ENABLED state. + ctl_display_setting_content_type_t ContentType; ///< [in,out] Source content type known to panel. + ctl_display_setting_quantization_range_t QuantizationRange; ///< [in,out] Quantization range + ctl_display_setting_picture_ar_flags_t SupportedPictureAR; ///< [out] Supported Picture aspect ratios + ctl_display_setting_picture_ar_flag_t PictureAR;///< [in,out] Picture aspect ratio + ctl_display_setting_audio_t AudioSettings; ///< [in,out] Audio settings + uint32_t Reserved[25]; ///< [out] Reserved fields for future enumerations + +} ctl_display_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Display settings +/// +/// @details +/// - To get/set end display settings like low latency, HDR10+ signaling +/// etc. which are controlled via info-frames/secondary data packets +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pDisplaySettings` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetDisplaySettings( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_display_settings_t* pDisplaySettings ///< [in,out] End display capabilities + ); + #if !defined(__GNUC__) #pragma endregion // display @@ -7325,6 +7478,14 @@ typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetWireFormat_t)( ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetDisplaySettings +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDisplaySettings_t)( + ctl_display_output_handle_t, + ctl_display_settings_t* + ); + + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for ctlEnumEngineGroups typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumEngineGroups_t)( diff --git a/wrapper/cApiWrapper.cpp b/wrapper/cApiWrapper.cpp index ef672cd..9acdd38 100644 --- a/wrapper/cApiWrapper.cpp +++ b/wrapper/cApiWrapper.cpp @@ -31,10 +31,16 @@ static HINSTANCE hinstLib = NULL; static ctl_runtime_path_args_t* pRuntimeArgs = NULL; +HINSTANCE GetLoaderHandle(void) +{ + return hinstLib; +} + /** * @brief Function to get DLL name based on app version * */ + #if defined(_WIN64) #define CTL_DLL_NAME L"ControlLib" #else @@ -54,10 +60,15 @@ ctl_result_t GetControlAPIDLLPath(ctl_init_args_t* pInitArgs, wchar_t* pwcDLLPat if (majorVersion > CTL_IMPL_MAJOR_VERSION) return CTL_RESULT_ERROR_UNSUPPORTED_VERSION; +#if (CTL_IMPL_MAJOR_VERSION > 1) if (majorVersion > 1) StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s%d.dll", CTL_DLL_NAME, majorVersion); else // just control_api.dll StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s.dll", CTL_DLL_NAME); +#else + StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s.dll", CTL_DLL_NAME); +#endif + } else if (pRuntimeArgs->pRuntimePath) { @@ -68,6 +79,7 @@ ctl_result_t GetControlAPIDLLPath(ctl_init_args_t* pInitArgs, wchar_t* pwcDLLPat } + /** * @brief Control Api Init * @@ -105,7 +117,7 @@ ctlInit( #ifdef _DEBUG dwFlags = dwFlags | LOAD_LIBRARY_SEARCH_APPLICATION_DIR; #endif - hinstLib = LoadLibraryExW(strDLLPath, NULL, dwFlags); + hinstLib = LoadLibraryExW(strDLLPath, NULL, dwFlags); #endif if (NULL == hinstLib) { @@ -114,13 +126,15 @@ ctlInit( else if (pRuntimeArgs) { ctlSetRuntimePath(pRuntimeArgs); - } - } + } + } } - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnInit_t pfnInit = (ctl_pfnInit_t)GetProcAddress(hinstLib, "ctlInit"); + ctl_pfnInit_t pfnInit = (ctl_pfnInit_t)GetProcAddress(hinstLibPtr, "ctlInit"); if (pfnInit) { result = pfnInit(pInitDesc, phAPIHandle); @@ -154,9 +168,11 @@ ctlClose( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnClose_t pfnClose = (ctl_pfnClose_t)GetProcAddress(hinstLib, "ctlClose"); + ctl_pfnClose_t pfnClose = (ctl_pfnClose_t)GetProcAddress(hinstLibPtr, "ctlClose"); if (pfnClose) { result = pfnClose(hAPIHandle); @@ -171,7 +187,7 @@ ctlClose( if (NULL != hinstLib) { FreeLibrary(hinstLib); - hinstLib = NULL; + hinstLib = NULL; } } // set runtime args back to NULL @@ -207,9 +223,11 @@ ctlSetRuntimePath( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnSetRuntimePath_t pfnSetRuntimePath = (ctl_pfnSetRuntimePath_t)GetProcAddress(hinstLib, "ctlSetRuntimePath"); + ctl_pfnSetRuntimePath_t pfnSetRuntimePath = (ctl_pfnSetRuntimePath_t)GetProcAddress(hinstLibPtr, "ctlSetRuntimePath"); if (pfnSetRuntimePath) { result = pfnSetRuntimePath(pArgs); @@ -256,9 +274,11 @@ ctlWaitForPropertyChange( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnWaitForPropertyChange_t pfnWaitForPropertyChange = (ctl_pfnWaitForPropertyChange_t)GetProcAddress(hinstLib, "ctlWaitForPropertyChange"); + ctl_pfnWaitForPropertyChange_t pfnWaitForPropertyChange = (ctl_pfnWaitForPropertyChange_t)GetProcAddress(hinstLibPtr, "ctlWaitForPropertyChange"); if (pfnWaitForPropertyChange) { result = pfnWaitForPropertyChange(hDeviceAdapter, pArgs); @@ -294,9 +314,11 @@ ctlReservedCall( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnReservedCall_t pfnReservedCall = (ctl_pfnReservedCall_t)GetProcAddress(hinstLib, "ctlReservedCall"); + ctl_pfnReservedCall_t pfnReservedCall = (ctl_pfnReservedCall_t)GetProcAddress(hinstLibPtr, "ctlReservedCall"); if (pfnReservedCall) { result = pfnReservedCall(hDeviceAdapter, pArgs); @@ -332,9 +354,11 @@ ctlGetSupported3DCapabilities( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSupported3DCapabilities_t pfnGetSupported3DCapabilities = (ctl_pfnGetSupported3DCapabilities_t)GetProcAddress(hinstLib, "ctlGetSupported3DCapabilities"); + ctl_pfnGetSupported3DCapabilities_t pfnGetSupported3DCapabilities = (ctl_pfnGetSupported3DCapabilities_t)GetProcAddress(hinstLibPtr, "ctlGetSupported3DCapabilities"); if (pfnGetSupported3DCapabilities) { result = pfnGetSupported3DCapabilities(hDAhandle, pFeatureCaps); @@ -370,9 +394,11 @@ ctlGetSet3DFeature( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSet3DFeature_t pfnGetSet3DFeature = (ctl_pfnGetSet3DFeature_t)GetProcAddress(hinstLib, "ctlGetSet3DFeature"); + ctl_pfnGetSet3DFeature_t pfnGetSet3DFeature = (ctl_pfnGetSet3DFeature_t)GetProcAddress(hinstLibPtr, "ctlGetSet3DFeature"); if (pfnGetSet3DFeature) { result = pfnGetSet3DFeature(hDAhandle, pFeature); @@ -406,9 +432,11 @@ ctlCheckDriverVersion( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnCheckDriverVersion_t pfnCheckDriverVersion = (ctl_pfnCheckDriverVersion_t)GetProcAddress(hinstLib, "ctlCheckDriverVersion"); + ctl_pfnCheckDriverVersion_t pfnCheckDriverVersion = (ctl_pfnCheckDriverVersion_t)GetProcAddress(hinstLibPtr, "ctlCheckDriverVersion"); if (pfnCheckDriverVersion) { result = pfnCheckDriverVersion(hDeviceAdapter, version_info); @@ -452,9 +480,11 @@ ctlEnumerateDevices( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumerateDevices_t pfnEnumerateDevices = (ctl_pfnEnumerateDevices_t)GetProcAddress(hinstLib, "ctlEnumerateDevices"); + ctl_pfnEnumerateDevices_t pfnEnumerateDevices = (ctl_pfnEnumerateDevices_t)GetProcAddress(hinstLibPtr, "ctlEnumerateDevices"); if (pfnEnumerateDevices) { result = pfnEnumerateDevices(hAPIHandle, pCount, phDevices); @@ -497,9 +527,11 @@ ctlEnumerateDisplayOutputs( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumerateDisplayOutputs_t pfnEnumerateDisplayOutputs = (ctl_pfnEnumerateDisplayOutputs_t)GetProcAddress(hinstLib, "ctlEnumerateDisplayOutputs"); + ctl_pfnEnumerateDisplayOutputs_t pfnEnumerateDisplayOutputs = (ctl_pfnEnumerateDisplayOutputs_t)GetProcAddress(hinstLibPtr, "ctlEnumerateDisplayOutputs"); if (pfnEnumerateDisplayOutputs) { result = pfnEnumerateDisplayOutputs(hDeviceAdapter, pCount, phDisplayOutputs); @@ -546,9 +578,11 @@ ctlEnumerateI2CPinPairs( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumerateI2CPinPairs_t pfnEnumerateI2CPinPairs = (ctl_pfnEnumerateI2CPinPairs_t)GetProcAddress(hinstLib, "ctlEnumerateI2CPinPairs"); + ctl_pfnEnumerateI2CPinPairs_t pfnEnumerateI2CPinPairs = (ctl_pfnEnumerateI2CPinPairs_t)GetProcAddress(hinstLibPtr, "ctlEnumerateI2CPinPairs"); if (pfnEnumerateI2CPinPairs) { result = pfnEnumerateI2CPinPairs(hDeviceAdapter, pCount, phI2cPinPairs); @@ -584,9 +618,11 @@ ctlGetDeviceProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetDeviceProperties_t pfnGetDeviceProperties = (ctl_pfnGetDeviceProperties_t)GetProcAddress(hinstLib, "ctlGetDeviceProperties"); + ctl_pfnGetDeviceProperties_t pfnGetDeviceProperties = (ctl_pfnGetDeviceProperties_t)GetProcAddress(hinstLibPtr, "ctlGetDeviceProperties"); if (pfnGetDeviceProperties) { result = pfnGetDeviceProperties(hDAhandle, pProperties); @@ -622,9 +658,11 @@ ctlGetDisplayProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetDisplayProperties_t pfnGetDisplayProperties = (ctl_pfnGetDisplayProperties_t)GetProcAddress(hinstLib, "ctlGetDisplayProperties"); + ctl_pfnGetDisplayProperties_t pfnGetDisplayProperties = (ctl_pfnGetDisplayProperties_t)GetProcAddress(hinstLibPtr, "ctlGetDisplayProperties"); if (pfnGetDisplayProperties) { result = pfnGetDisplayProperties(hDisplayOutput, pProperties); @@ -660,9 +698,11 @@ ctlGetAdaperDisplayEncoderProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetAdaperDisplayEncoderProperties_t pfnGetAdaperDisplayEncoderProperties = (ctl_pfnGetAdaperDisplayEncoderProperties_t)GetProcAddress(hinstLib, "ctlGetAdaperDisplayEncoderProperties"); + ctl_pfnGetAdaperDisplayEncoderProperties_t pfnGetAdaperDisplayEncoderProperties = (ctl_pfnGetAdaperDisplayEncoderProperties_t)GetProcAddress(hinstLibPtr, "ctlGetAdaperDisplayEncoderProperties"); if (pfnGetAdaperDisplayEncoderProperties) { result = pfnGetAdaperDisplayEncoderProperties(hDisplayOutput, pProperties); @@ -701,9 +741,11 @@ ctlGetZeDevice( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetZeDevice_t pfnGetZeDevice = (ctl_pfnGetZeDevice_t)GetProcAddress(hinstLib, "ctlGetZeDevice"); + ctl_pfnGetZeDevice_t pfnGetZeDevice = (ctl_pfnGetZeDevice_t)GetProcAddress(hinstLibPtr, "ctlGetZeDevice"); if (pfnGetZeDevice) { result = pfnGetZeDevice(hDAhandle, pZeDevice, hInstance); @@ -739,9 +781,11 @@ ctlGetSharpnessCaps( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSharpnessCaps_t pfnGetSharpnessCaps = (ctl_pfnGetSharpnessCaps_t)GetProcAddress(hinstLib, "ctlGetSharpnessCaps"); + ctl_pfnGetSharpnessCaps_t pfnGetSharpnessCaps = (ctl_pfnGetSharpnessCaps_t)GetProcAddress(hinstLibPtr, "ctlGetSharpnessCaps"); if (pfnGetSharpnessCaps) { result = pfnGetSharpnessCaps(hDisplayOutput, pSharpnessCaps); @@ -777,9 +821,11 @@ ctlGetCurrentSharpness( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetCurrentSharpness_t pfnGetCurrentSharpness = (ctl_pfnGetCurrentSharpness_t)GetProcAddress(hinstLib, "ctlGetCurrentSharpness"); + ctl_pfnGetCurrentSharpness_t pfnGetCurrentSharpness = (ctl_pfnGetCurrentSharpness_t)GetProcAddress(hinstLibPtr, "ctlGetCurrentSharpness"); if (pfnGetCurrentSharpness) { result = pfnGetCurrentSharpness(hDisplayOutput, pSharpnessSettings); @@ -815,9 +861,11 @@ ctlSetCurrentSharpness( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnSetCurrentSharpness_t pfnSetCurrentSharpness = (ctl_pfnSetCurrentSharpness_t)GetProcAddress(hinstLib, "ctlSetCurrentSharpness"); + ctl_pfnSetCurrentSharpness_t pfnSetCurrentSharpness = (ctl_pfnSetCurrentSharpness_t)GetProcAddress(hinstLibPtr, "ctlSetCurrentSharpness"); if (pfnSetCurrentSharpness) { result = pfnSetCurrentSharpness(hDisplayOutput, pSharpnessSettings); @@ -861,9 +909,11 @@ ctlI2CAccess( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnI2CAccess_t pfnI2CAccess = (ctl_pfnI2CAccess_t)GetProcAddress(hinstLib, "ctlI2CAccess"); + ctl_pfnI2CAccess_t pfnI2CAccess = (ctl_pfnI2CAccess_t)GetProcAddress(hinstLibPtr, "ctlI2CAccess"); if (pfnI2CAccess) { result = pfnI2CAccess(hDisplayOutput, pI2cAccessArgs); @@ -910,9 +960,11 @@ ctlI2CAccessOnPinPair( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnI2CAccessOnPinPair_t pfnI2CAccessOnPinPair = (ctl_pfnI2CAccessOnPinPair_t)GetProcAddress(hinstLib, "ctlI2CAccessOnPinPair"); + ctl_pfnI2CAccessOnPinPair_t pfnI2CAccessOnPinPair = (ctl_pfnI2CAccessOnPinPair_t)GetProcAddress(hinstLibPtr, "ctlI2CAccessOnPinPair"); if (pfnI2CAccessOnPinPair) { result = pfnI2CAccessOnPinPair(hI2cPinPair, pI2cAccessArgs); @@ -958,9 +1010,11 @@ ctlAUXAccess( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnAUXAccess_t pfnAUXAccess = (ctl_pfnAUXAccess_t)GetProcAddress(hinstLib, "ctlAUXAccess"); + ctl_pfnAUXAccess_t pfnAUXAccess = (ctl_pfnAUXAccess_t)GetProcAddress(hinstLibPtr, "ctlAUXAccess"); if (pfnAUXAccess) { result = pfnAUXAccess(hDisplayOutput, pAuxAccessArgs); @@ -996,9 +1050,11 @@ ctlGetPowerOptimizationCaps( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetPowerOptimizationCaps_t pfnGetPowerOptimizationCaps = (ctl_pfnGetPowerOptimizationCaps_t)GetProcAddress(hinstLib, "ctlGetPowerOptimizationCaps"); + ctl_pfnGetPowerOptimizationCaps_t pfnGetPowerOptimizationCaps = (ctl_pfnGetPowerOptimizationCaps_t)GetProcAddress(hinstLibPtr, "ctlGetPowerOptimizationCaps"); if (pfnGetPowerOptimizationCaps) { result = pfnGetPowerOptimizationCaps(hDisplayOutput, pPowerOptimizationCaps); @@ -1036,9 +1092,11 @@ ctlGetPowerOptimizationSetting( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetPowerOptimizationSetting_t pfnGetPowerOptimizationSetting = (ctl_pfnGetPowerOptimizationSetting_t)GetProcAddress(hinstLib, "ctlGetPowerOptimizationSetting"); + ctl_pfnGetPowerOptimizationSetting_t pfnGetPowerOptimizationSetting = (ctl_pfnGetPowerOptimizationSetting_t)GetProcAddress(hinstLibPtr, "ctlGetPowerOptimizationSetting"); if (pfnGetPowerOptimizationSetting) { result = pfnGetPowerOptimizationSetting(hDisplayOutput, pPowerOptimizationSettings); @@ -1077,9 +1135,11 @@ ctlSetPowerOptimizationSetting( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnSetPowerOptimizationSetting_t pfnSetPowerOptimizationSetting = (ctl_pfnSetPowerOptimizationSetting_t)GetProcAddress(hinstLib, "ctlSetPowerOptimizationSetting"); + ctl_pfnSetPowerOptimizationSetting_t pfnSetPowerOptimizationSetting = (ctl_pfnSetPowerOptimizationSetting_t)GetProcAddress(hinstLibPtr, "ctlSetPowerOptimizationSetting"); if (pfnSetPowerOptimizationSetting) { result = pfnSetPowerOptimizationSetting(hDisplayOutput, pPowerOptimizationSettings); @@ -1119,9 +1179,11 @@ ctlSetBrightnessSetting( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnSetBrightnessSetting_t pfnSetBrightnessSetting = (ctl_pfnSetBrightnessSetting_t)GetProcAddress(hinstLib, "ctlSetBrightnessSetting"); + ctl_pfnSetBrightnessSetting_t pfnSetBrightnessSetting = (ctl_pfnSetBrightnessSetting_t)GetProcAddress(hinstLibPtr, "ctlSetBrightnessSetting"); if (pfnSetBrightnessSetting) { result = pfnSetBrightnessSetting(hDisplayOutput, pSetBrightnessSetting); @@ -1160,9 +1222,11 @@ ctlGetBrightnessSetting( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetBrightnessSetting_t pfnGetBrightnessSetting = (ctl_pfnGetBrightnessSetting_t)GetProcAddress(hinstLib, "ctlGetBrightnessSetting"); + ctl_pfnGetBrightnessSetting_t pfnGetBrightnessSetting = (ctl_pfnGetBrightnessSetting_t)GetProcAddress(hinstLibPtr, "ctlGetBrightnessSetting"); if (pfnGetBrightnessSetting) { result = pfnGetBrightnessSetting(hDisplayOutput, pGetBrightnessSetting); @@ -1212,9 +1276,11 @@ ctlPixelTransformationGetConfig( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPixelTransformationGetConfig_t pfnPixelTransformationGetConfig = (ctl_pfnPixelTransformationGetConfig_t)GetProcAddress(hinstLib, "ctlPixelTransformationGetConfig"); + ctl_pfnPixelTransformationGetConfig_t pfnPixelTransformationGetConfig = (ctl_pfnPixelTransformationGetConfig_t)GetProcAddress(hinstLibPtr, "ctlPixelTransformationGetConfig"); if (pfnPixelTransformationGetConfig) { result = pfnPixelTransformationGetConfig(hDisplayOutput, pPixTxGetConfigArgs); @@ -1265,9 +1331,11 @@ ctlPixelTransformationSetConfig( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPixelTransformationSetConfig_t pfnPixelTransformationSetConfig = (ctl_pfnPixelTransformationSetConfig_t)GetProcAddress(hinstLib, "ctlPixelTransformationSetConfig"); + ctl_pfnPixelTransformationSetConfig_t pfnPixelTransformationSetConfig = (ctl_pfnPixelTransformationSetConfig_t)GetProcAddress(hinstLibPtr, "ctlPixelTransformationSetConfig"); if (pfnPixelTransformationSetConfig) { result = pfnPixelTransformationSetConfig(hDisplayOutput, pPixTxSetConfigArgs); @@ -1310,9 +1378,11 @@ ctlPanelDescriptorAccess( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPanelDescriptorAccess_t pfnPanelDescriptorAccess = (ctl_pfnPanelDescriptorAccess_t)GetProcAddress(hinstLib, "ctlPanelDescriptorAccess"); + ctl_pfnPanelDescriptorAccess_t pfnPanelDescriptorAccess = (ctl_pfnPanelDescriptorAccess_t)GetProcAddress(hinstLibPtr, "ctlPanelDescriptorAccess"); if (pfnPanelDescriptorAccess) { result = pfnPanelDescriptorAccess(hDisplayOutput, pPanelDescriptorAccessArgs); @@ -1348,9 +1418,11 @@ ctlGetSupportedRetroScalingCapability( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSupportedRetroScalingCapability_t pfnGetSupportedRetroScalingCapability = (ctl_pfnGetSupportedRetroScalingCapability_t)GetProcAddress(hinstLib, "ctlGetSupportedRetroScalingCapability"); + ctl_pfnGetSupportedRetroScalingCapability_t pfnGetSupportedRetroScalingCapability = (ctl_pfnGetSupportedRetroScalingCapability_t)GetProcAddress(hinstLibPtr, "ctlGetSupportedRetroScalingCapability"); if (pfnGetSupportedRetroScalingCapability) { result = pfnGetSupportedRetroScalingCapability(hDAhandle, pRetroScalingCaps); @@ -1387,9 +1459,11 @@ ctlGetSetRetroScaling( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSetRetroScaling_t pfnGetSetRetroScaling = (ctl_pfnGetSetRetroScaling_t)GetProcAddress(hinstLib, "ctlGetSetRetroScaling"); + ctl_pfnGetSetRetroScaling_t pfnGetSetRetroScaling = (ctl_pfnGetSetRetroScaling_t)GetProcAddress(hinstLibPtr, "ctlGetSetRetroScaling"); if (pfnGetSetRetroScaling) { result = pfnGetSetRetroScaling(hDAhandle, pGetSetRetroScalingType); @@ -1425,9 +1499,11 @@ ctlGetSupportedScalingCapability( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSupportedScalingCapability_t pfnGetSupportedScalingCapability = (ctl_pfnGetSupportedScalingCapability_t)GetProcAddress(hinstLib, "ctlGetSupportedScalingCapability"); + ctl_pfnGetSupportedScalingCapability_t pfnGetSupportedScalingCapability = (ctl_pfnGetSupportedScalingCapability_t)GetProcAddress(hinstLibPtr, "ctlGetSupportedScalingCapability"); if (pfnGetSupportedScalingCapability) { result = pfnGetSupportedScalingCapability(hDisplayOutput, pScalingCaps); @@ -1463,9 +1539,11 @@ ctlGetCurrentScaling( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetCurrentScaling_t pfnGetCurrentScaling = (ctl_pfnGetCurrentScaling_t)GetProcAddress(hinstLib, "ctlGetCurrentScaling"); + ctl_pfnGetCurrentScaling_t pfnGetCurrentScaling = (ctl_pfnGetCurrentScaling_t)GetProcAddress(hinstLibPtr, "ctlGetCurrentScaling"); if (pfnGetCurrentScaling) { result = pfnGetCurrentScaling(hDisplayOutput, pGetCurrentScalingType); @@ -1501,9 +1579,11 @@ ctlSetCurrentScaling( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnSetCurrentScaling_t pfnSetCurrentScaling = (ctl_pfnSetCurrentScaling_t)GetProcAddress(hinstLib, "ctlSetCurrentScaling"); + ctl_pfnSetCurrentScaling_t pfnSetCurrentScaling = (ctl_pfnSetCurrentScaling_t)GetProcAddress(hinstLibPtr, "ctlSetCurrentScaling"); if (pfnSetCurrentScaling) { result = pfnSetCurrentScaling(hDisplayOutput, pSetScalingType); @@ -1540,9 +1620,11 @@ ctlGetLACEConfig( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetLACEConfig_t pfnGetLACEConfig = (ctl_pfnGetLACEConfig_t)GetProcAddress(hinstLib, "ctlGetLACEConfig"); + ctl_pfnGetLACEConfig_t pfnGetLACEConfig = (ctl_pfnGetLACEConfig_t)GetProcAddress(hinstLibPtr, "ctlGetLACEConfig"); if (pfnGetLACEConfig) { result = pfnGetLACEConfig(hDisplayOutput, pLaceConfig); @@ -1579,9 +1661,11 @@ ctlSetLACEConfig( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnSetLACEConfig_t pfnSetLACEConfig = (ctl_pfnSetLACEConfig_t)GetProcAddress(hinstLib, "ctlSetLACEConfig"); + ctl_pfnSetLACEConfig_t pfnSetLACEConfig = (ctl_pfnSetLACEConfig_t)GetProcAddress(hinstLibPtr, "ctlSetLACEConfig"); if (pfnSetLACEConfig) { result = pfnSetLACEConfig(hDisplayOutput, pLaceConfig); @@ -1621,9 +1705,11 @@ ctlSoftwarePSR( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnSoftwarePSR_t pfnSoftwarePSR = (ctl_pfnSoftwarePSR_t)GetProcAddress(hinstLib, "ctlSoftwarePSR"); + ctl_pfnSoftwarePSR_t pfnSoftwarePSR = (ctl_pfnSoftwarePSR_t)GetProcAddress(hinstLibPtr, "ctlSoftwarePSR"); if (pfnSoftwarePSR) { result = pfnSoftwarePSR(hDisplayOutput, pSoftwarePsrSetting); @@ -1659,9 +1745,11 @@ ctlGetIntelArcSyncInfoForMonitor( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetIntelArcSyncInfoForMonitor_t pfnGetIntelArcSyncInfoForMonitor = (ctl_pfnGetIntelArcSyncInfoForMonitor_t)GetProcAddress(hinstLib, "ctlGetIntelArcSyncInfoForMonitor"); + ctl_pfnGetIntelArcSyncInfoForMonitor_t pfnGetIntelArcSyncInfoForMonitor = (ctl_pfnGetIntelArcSyncInfoForMonitor_t)GetProcAddress(hinstLibPtr, "ctlGetIntelArcSyncInfoForMonitor"); if (pfnGetIntelArcSyncInfoForMonitor) { result = pfnGetIntelArcSyncInfoForMonitor(hDisplayOutput, pIntelArcSyncMonitorParams); @@ -1705,9 +1793,11 @@ ctlEnumerateMuxDevices( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumerateMuxDevices_t pfnEnumerateMuxDevices = (ctl_pfnEnumerateMuxDevices_t)GetProcAddress(hinstLib, "ctlEnumerateMuxDevices"); + ctl_pfnEnumerateMuxDevices_t pfnEnumerateMuxDevices = (ctl_pfnEnumerateMuxDevices_t)GetProcAddress(hinstLibPtr, "ctlEnumerateMuxDevices"); if (pfnEnumerateMuxDevices) { result = pfnEnumerateMuxDevices(hAPIHandle, pCount, phMuxDevices); @@ -1743,9 +1833,11 @@ ctlGetMuxProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetMuxProperties_t pfnGetMuxProperties = (ctl_pfnGetMuxProperties_t)GetProcAddress(hinstLib, "ctlGetMuxProperties"); + ctl_pfnGetMuxProperties_t pfnGetMuxProperties = (ctl_pfnGetMuxProperties_t)GetProcAddress(hinstLibPtr, "ctlGetMuxProperties"); if (pfnGetMuxProperties) { result = pfnGetMuxProperties(hMuxDevice, pMuxProperties); @@ -1782,9 +1874,11 @@ ctlSwitchMux( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnSwitchMux_t pfnSwitchMux = (ctl_pfnSwitchMux_t)GetProcAddress(hinstLib, "ctlSwitchMux"); + ctl_pfnSwitchMux_t pfnSwitchMux = (ctl_pfnSwitchMux_t)GetProcAddress(hinstLibPtr, "ctlSwitchMux"); if (pfnSwitchMux) { result = pfnSwitchMux(hMuxDevice, hInactiveDisplayOutput); @@ -1820,9 +1914,11 @@ ctlGetIntelArcSyncProfile( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetIntelArcSyncProfile_t pfnGetIntelArcSyncProfile = (ctl_pfnGetIntelArcSyncProfile_t)GetProcAddress(hinstLib, "ctlGetIntelArcSyncProfile"); + ctl_pfnGetIntelArcSyncProfile_t pfnGetIntelArcSyncProfile = (ctl_pfnGetIntelArcSyncProfile_t)GetProcAddress(hinstLibPtr, "ctlGetIntelArcSyncProfile"); if (pfnGetIntelArcSyncProfile) { result = pfnGetIntelArcSyncProfile(hDisplayOutput, pIntelArcSyncProfileParams); @@ -1860,9 +1956,11 @@ ctlSetIntelArcSyncProfile( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnSetIntelArcSyncProfile_t pfnSetIntelArcSyncProfile = (ctl_pfnSetIntelArcSyncProfile_t)GetProcAddress(hinstLib, "ctlSetIntelArcSyncProfile"); + ctl_pfnSetIntelArcSyncProfile_t pfnSetIntelArcSyncProfile = (ctl_pfnSetIntelArcSyncProfile_t)GetProcAddress(hinstLibPtr, "ctlSetIntelArcSyncProfile"); if (pfnSetIntelArcSyncProfile) { result = pfnSetIntelArcSyncProfile(hDisplayOutput, pIntelArcSyncProfileParams); @@ -1909,9 +2007,11 @@ ctlEdidManagement( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEdidManagement_t pfnEdidManagement = (ctl_pfnEdidManagement_t)GetProcAddress(hinstLib, "ctlEdidManagement"); + ctl_pfnEdidManagement_t pfnEdidManagement = (ctl_pfnEdidManagement_t)GetProcAddress(hinstLibPtr, "ctlEdidManagement"); if (pfnEdidManagement) { result = pfnEdidManagement(hDisplayOutput, pEdidManagementArgs); @@ -1961,9 +2061,11 @@ ctlGetSetCustomMode( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSetCustomMode_t pfnGetSetCustomMode = (ctl_pfnGetSetCustomMode_t)GetProcAddress(hinstLib, "ctlGetSetCustomMode"); + ctl_pfnGetSetCustomMode_t pfnGetSetCustomMode = (ctl_pfnGetSetCustomMode_t)GetProcAddress(hinstLibPtr, "ctlGetSetCustomMode"); if (pfnGetSetCustomMode) { result = pfnGetSetCustomMode(hDisplayOutput, pCustomModeArgs); @@ -2017,9 +2119,11 @@ ctlGetSetCombinedDisplay( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSetCombinedDisplay_t pfnGetSetCombinedDisplay = (ctl_pfnGetSetCombinedDisplay_t)GetProcAddress(hinstLib, "ctlGetSetCombinedDisplay"); + ctl_pfnGetSetCombinedDisplay_t pfnGetSetCombinedDisplay = (ctl_pfnGetSetCombinedDisplay_t)GetProcAddress(hinstLibPtr, "ctlGetSetCombinedDisplay"); if (pfnGetSetCombinedDisplay) { result = pfnGetSetCombinedDisplay(hDeviceAdapter, pCombinedDisplayArgs); @@ -2063,9 +2167,11 @@ ctlGetSetDisplayGenlock( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSetDisplayGenlock_t pfnGetSetDisplayGenlock = (ctl_pfnGetSetDisplayGenlock_t)GetProcAddress(hinstLib, "ctlGetSetDisplayGenlock"); + ctl_pfnGetSetDisplayGenlock_t pfnGetSetDisplayGenlock = (ctl_pfnGetSetDisplayGenlock_t)GetProcAddress(hinstLibPtr, "ctlGetSetDisplayGenlock"); if (pfnGetSetDisplayGenlock) { result = pfnGetSetDisplayGenlock(hDeviceAdapter, pGenlockArgs, AdapterCount, hFailureDeviceAdapter); @@ -2107,9 +2213,11 @@ ctlGetVblankTimestamp( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetVblankTimestamp_t pfnGetVblankTimestamp = (ctl_pfnGetVblankTimestamp_t)GetProcAddress(hinstLib, "ctlGetVblankTimestamp"); + ctl_pfnGetVblankTimestamp_t pfnGetVblankTimestamp = (ctl_pfnGetVblankTimestamp_t)GetProcAddress(hinstLibPtr, "ctlGetVblankTimestamp"); if (pfnGetVblankTimestamp) { result = pfnGetVblankTimestamp(hDisplayOutput, pVblankTSArgs); @@ -2150,9 +2258,11 @@ ctlLinkDisplayAdapters( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnLinkDisplayAdapters_t pfnLinkDisplayAdapters = (ctl_pfnLinkDisplayAdapters_t)GetProcAddress(hinstLib, "ctlLinkDisplayAdapters"); + ctl_pfnLinkDisplayAdapters_t pfnLinkDisplayAdapters = (ctl_pfnLinkDisplayAdapters_t)GetProcAddress(hinstLibPtr, "ctlLinkDisplayAdapters"); if (pfnLinkDisplayAdapters) { result = pfnLinkDisplayAdapters(hPrimaryAdapter, pLdaArgs); @@ -2189,9 +2299,11 @@ ctlUnlinkDisplayAdapters( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnUnlinkDisplayAdapters_t pfnUnlinkDisplayAdapters = (ctl_pfnUnlinkDisplayAdapters_t)GetProcAddress(hinstLib, "ctlUnlinkDisplayAdapters"); + ctl_pfnUnlinkDisplayAdapters_t pfnUnlinkDisplayAdapters = (ctl_pfnUnlinkDisplayAdapters_t)GetProcAddress(hinstLibPtr, "ctlUnlinkDisplayAdapters"); if (pfnUnlinkDisplayAdapters) { result = pfnUnlinkDisplayAdapters(hPrimaryAdapter); @@ -2232,9 +2344,11 @@ ctlGetLinkedDisplayAdapters( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetLinkedDisplayAdapters_t pfnGetLinkedDisplayAdapters = (ctl_pfnGetLinkedDisplayAdapters_t)GetProcAddress(hinstLib, "ctlGetLinkedDisplayAdapters"); + ctl_pfnGetLinkedDisplayAdapters_t pfnGetLinkedDisplayAdapters = (ctl_pfnGetLinkedDisplayAdapters_t)GetProcAddress(hinstLibPtr, "ctlGetLinkedDisplayAdapters"); if (pfnGetLinkedDisplayAdapters) { result = pfnGetLinkedDisplayAdapters(hPrimaryAdapter, pLdaArgs); @@ -2279,9 +2393,11 @@ ctlGetSetDynamicContrastEnhancement( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSetDynamicContrastEnhancement_t pfnGetSetDynamicContrastEnhancement = (ctl_pfnGetSetDynamicContrastEnhancement_t)GetProcAddress(hinstLib, "ctlGetSetDynamicContrastEnhancement"); + ctl_pfnGetSetDynamicContrastEnhancement_t pfnGetSetDynamicContrastEnhancement = (ctl_pfnGetSetDynamicContrastEnhancement_t)GetProcAddress(hinstLibPtr, "ctlGetSetDynamicContrastEnhancement"); if (pfnGetSetDynamicContrastEnhancement) { result = pfnGetSetDynamicContrastEnhancement(hDisplayOutput, pDceArgs); @@ -2323,9 +2439,11 @@ ctlGetSetWireFormat( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSetWireFormat_t pfnGetSetWireFormat = (ctl_pfnGetSetWireFormat_t)GetProcAddress(hinstLib, "ctlGetSetWireFormat"); + ctl_pfnGetSetWireFormat_t pfnGetSetWireFormat = (ctl_pfnGetSetWireFormat_t)GetProcAddress(hinstLibPtr, "ctlGetSetWireFormat"); if (pfnGetSetWireFormat) { result = pfnGetSetWireFormat(hDisplayOutput, pGetSetWireFormatSetting); @@ -2336,6 +2454,55 @@ ctlGetSetWireFormat( } +/** +* @brief Get/Set Display settings +* +* @details +* - To get/set end display settings like low latency, HDR10+ signaling +* etc. which are controlled via info-frames/secondary data packets +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pDisplaySettings` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +*/ +ctl_result_t CTL_APICALL +ctlGetSetDisplaySettings( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_display_settings_t* pDisplaySettings ///< [in,out] End display capabilities + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSetDisplaySettings_t pfnGetSetDisplaySettings = (ctl_pfnGetSetDisplaySettings_t)GetProcAddress(hinstLibPtr, "ctlGetSetDisplaySettings"); + if (pfnGetSetDisplaySettings) + { + result = pfnGetSetDisplaySettings(hDisplayOutput, pDisplaySettings); + } + } + + return result; +} + + /** * @brief Get handle of engine groups * @@ -2371,9 +2538,11 @@ ctlEnumEngineGroups( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumEngineGroups_t pfnEnumEngineGroups = (ctl_pfnEnumEngineGroups_t)GetProcAddress(hinstLib, "ctlEnumEngineGroups"); + ctl_pfnEnumEngineGroups_t pfnEnumEngineGroups = (ctl_pfnEnumEngineGroups_t)GetProcAddress(hinstLibPtr, "ctlEnumEngineGroups"); if (pfnEnumEngineGroups) { result = pfnEnumEngineGroups(hDAhandle, pCount, phEngine); @@ -2409,9 +2578,11 @@ ctlEngineGetProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEngineGetProperties_t pfnEngineGetProperties = (ctl_pfnEngineGetProperties_t)GetProcAddress(hinstLib, "ctlEngineGetProperties"); + ctl_pfnEngineGetProperties_t pfnEngineGetProperties = (ctl_pfnEngineGetProperties_t)GetProcAddress(hinstLibPtr, "ctlEngineGetProperties"); if (pfnEngineGetProperties) { result = pfnEngineGetProperties(hEngine, pProperties); @@ -2448,9 +2619,11 @@ ctlEngineGetActivity( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEngineGetActivity_t pfnEngineGetActivity = (ctl_pfnEngineGetActivity_t)GetProcAddress(hinstLib, "ctlEngineGetActivity"); + ctl_pfnEngineGetActivity_t pfnEngineGetActivity = (ctl_pfnEngineGetActivity_t)GetProcAddress(hinstLibPtr, "ctlEngineGetActivity"); if (pfnEngineGetActivity) { result = pfnEngineGetActivity(hEngine, pStats); @@ -2496,9 +2669,11 @@ ctlEnumFans( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumFans_t pfnEnumFans = (ctl_pfnEnumFans_t)GetProcAddress(hinstLib, "ctlEnumFans"); + ctl_pfnEnumFans_t pfnEnumFans = (ctl_pfnEnumFans_t)GetProcAddress(hinstLibPtr, "ctlEnumFans"); if (pfnEnumFans) { result = pfnEnumFans(hDAhandle, pCount, phFan); @@ -2534,9 +2709,11 @@ ctlFanGetProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFanGetProperties_t pfnFanGetProperties = (ctl_pfnFanGetProperties_t)GetProcAddress(hinstLib, "ctlFanGetProperties"); + ctl_pfnFanGetProperties_t pfnFanGetProperties = (ctl_pfnFanGetProperties_t)GetProcAddress(hinstLibPtr, "ctlFanGetProperties"); if (pfnFanGetProperties) { result = pfnFanGetProperties(hFan, pProperties); @@ -2573,9 +2750,11 @@ ctlFanGetConfig( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFanGetConfig_t pfnFanGetConfig = (ctl_pfnFanGetConfig_t)GetProcAddress(hinstLib, "ctlFanGetConfig"); + ctl_pfnFanGetConfig_t pfnFanGetConfig = (ctl_pfnFanGetConfig_t)GetProcAddress(hinstLibPtr, "ctlFanGetConfig"); if (pfnFanGetConfig) { result = pfnFanGetConfig(hFan, pConfig); @@ -2611,9 +2790,11 @@ ctlFanSetDefaultMode( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFanSetDefaultMode_t pfnFanSetDefaultMode = (ctl_pfnFanSetDefaultMode_t)GetProcAddress(hinstLib, "ctlFanSetDefaultMode"); + ctl_pfnFanSetDefaultMode_t pfnFanSetDefaultMode = (ctl_pfnFanSetDefaultMode_t)GetProcAddress(hinstLibPtr, "ctlFanSetDefaultMode"); if (pfnFanSetDefaultMode) { result = pfnFanSetDefaultMode(hFan); @@ -2654,9 +2835,11 @@ ctlFanSetFixedSpeedMode( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFanSetFixedSpeedMode_t pfnFanSetFixedSpeedMode = (ctl_pfnFanSetFixedSpeedMode_t)GetProcAddress(hinstLib, "ctlFanSetFixedSpeedMode"); + ctl_pfnFanSetFixedSpeedMode_t pfnFanSetFixedSpeedMode = (ctl_pfnFanSetFixedSpeedMode_t)GetProcAddress(hinstLibPtr, "ctlFanSetFixedSpeedMode"); if (pfnFanSetFixedSpeedMode) { result = pfnFanSetFixedSpeedMode(hFan, speed); @@ -2699,9 +2882,11 @@ ctlFanSetSpeedTableMode( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFanSetSpeedTableMode_t pfnFanSetSpeedTableMode = (ctl_pfnFanSetSpeedTableMode_t)GetProcAddress(hinstLib, "ctlFanSetSpeedTableMode"); + ctl_pfnFanSetSpeedTableMode_t pfnFanSetSpeedTableMode = (ctl_pfnFanSetSpeedTableMode_t)GetProcAddress(hinstLibPtr, "ctlFanSetSpeedTableMode"); if (pfnFanSetSpeedTableMode) { result = pfnFanSetSpeedTableMode(hFan, speedTable); @@ -2744,9 +2929,11 @@ ctlFanGetState( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFanGetState_t pfnFanGetState = (ctl_pfnFanGetState_t)GetProcAddress(hinstLib, "ctlFanGetState"); + ctl_pfnFanGetState_t pfnFanGetState = (ctl_pfnFanGetState_t)GetProcAddress(hinstLibPtr, "ctlFanGetState"); if (pfnFanGetState) { result = pfnFanGetState(hFan, units, pSpeed); @@ -2792,9 +2979,11 @@ ctlEnumFrequencyDomains( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumFrequencyDomains_t pfnEnumFrequencyDomains = (ctl_pfnEnumFrequencyDomains_t)GetProcAddress(hinstLib, "ctlEnumFrequencyDomains"); + ctl_pfnEnumFrequencyDomains_t pfnEnumFrequencyDomains = (ctl_pfnEnumFrequencyDomains_t)GetProcAddress(hinstLibPtr, "ctlEnumFrequencyDomains"); if (pfnEnumFrequencyDomains) { result = pfnEnumFrequencyDomains(hDAhandle, pCount, phFrequency); @@ -2830,9 +3019,11 @@ ctlFrequencyGetProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFrequencyGetProperties_t pfnFrequencyGetProperties = (ctl_pfnFrequencyGetProperties_t)GetProcAddress(hinstLib, "ctlFrequencyGetProperties"); + ctl_pfnFrequencyGetProperties_t pfnFrequencyGetProperties = (ctl_pfnFrequencyGetProperties_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetProperties"); if (pfnFrequencyGetProperties) { result = pfnFrequencyGetProperties(hFrequency, pProperties); @@ -2879,9 +3070,11 @@ ctlFrequencyGetAvailableClocks( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFrequencyGetAvailableClocks_t pfnFrequencyGetAvailableClocks = (ctl_pfnFrequencyGetAvailableClocks_t)GetProcAddress(hinstLib, "ctlFrequencyGetAvailableClocks"); + ctl_pfnFrequencyGetAvailableClocks_t pfnFrequencyGetAvailableClocks = (ctl_pfnFrequencyGetAvailableClocks_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetAvailableClocks"); if (pfnFrequencyGetAvailableClocks) { result = pfnFrequencyGetAvailableClocks(hFrequency, pCount, phFrequency); @@ -2918,9 +3111,11 @@ ctlFrequencyGetRange( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFrequencyGetRange_t pfnFrequencyGetRange = (ctl_pfnFrequencyGetRange_t)GetProcAddress(hinstLib, "ctlFrequencyGetRange"); + ctl_pfnFrequencyGetRange_t pfnFrequencyGetRange = (ctl_pfnFrequencyGetRange_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetRange"); if (pfnFrequencyGetRange) { result = pfnFrequencyGetRange(hFrequency, pLimits); @@ -2959,9 +3154,11 @@ ctlFrequencySetRange( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFrequencySetRange_t pfnFrequencySetRange = (ctl_pfnFrequencySetRange_t)GetProcAddress(hinstLib, "ctlFrequencySetRange"); + ctl_pfnFrequencySetRange_t pfnFrequencySetRange = (ctl_pfnFrequencySetRange_t)GetProcAddress(hinstLibPtr, "ctlFrequencySetRange"); if (pfnFrequencySetRange) { result = pfnFrequencySetRange(hFrequency, pLimits); @@ -2998,9 +3195,11 @@ ctlFrequencyGetState( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFrequencyGetState_t pfnFrequencyGetState = (ctl_pfnFrequencyGetState_t)GetProcAddress(hinstLib, "ctlFrequencyGetState"); + ctl_pfnFrequencyGetState_t pfnFrequencyGetState = (ctl_pfnFrequencyGetState_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetState"); if (pfnFrequencyGetState) { result = pfnFrequencyGetState(hFrequency, pState); @@ -3037,9 +3236,11 @@ ctlFrequencyGetThrottleTime( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnFrequencyGetThrottleTime_t pfnFrequencyGetThrottleTime = (ctl_pfnFrequencyGetThrottleTime_t)GetProcAddress(hinstLib, "ctlFrequencyGetThrottleTime"); + ctl_pfnFrequencyGetThrottleTime_t pfnFrequencyGetThrottleTime = (ctl_pfnFrequencyGetThrottleTime_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetThrottleTime"); if (pfnFrequencyGetThrottleTime) { result = pfnFrequencyGetThrottleTime(hFrequency, pThrottleTime); @@ -3075,9 +3276,11 @@ ctlGetSupportedVideoProcessingCapabilities( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSupportedVideoProcessingCapabilities_t pfnGetSupportedVideoProcessingCapabilities = (ctl_pfnGetSupportedVideoProcessingCapabilities_t)GetProcAddress(hinstLib, "ctlGetSupportedVideoProcessingCapabilities"); + ctl_pfnGetSupportedVideoProcessingCapabilities_t pfnGetSupportedVideoProcessingCapabilities = (ctl_pfnGetSupportedVideoProcessingCapabilities_t)GetProcAddress(hinstLibPtr, "ctlGetSupportedVideoProcessingCapabilities"); if (pfnGetSupportedVideoProcessingCapabilities) { result = pfnGetSupportedVideoProcessingCapabilities(hDAhandle, pFeatureCaps); @@ -3113,9 +3316,11 @@ ctlGetSetVideoProcessingFeature( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnGetSetVideoProcessingFeature_t pfnGetSetVideoProcessingFeature = (ctl_pfnGetSetVideoProcessingFeature_t)GetProcAddress(hinstLib, "ctlGetSetVideoProcessingFeature"); + ctl_pfnGetSetVideoProcessingFeature_t pfnGetSetVideoProcessingFeature = (ctl_pfnGetSetVideoProcessingFeature_t)GetProcAddress(hinstLibPtr, "ctlGetSetVideoProcessingFeature"); if (pfnGetSetVideoProcessingFeature) { result = pfnGetSetVideoProcessingFeature(hDAhandle, pFeature); @@ -3161,9 +3366,11 @@ ctlEnumMemoryModules( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumMemoryModules_t pfnEnumMemoryModules = (ctl_pfnEnumMemoryModules_t)GetProcAddress(hinstLib, "ctlEnumMemoryModules"); + ctl_pfnEnumMemoryModules_t pfnEnumMemoryModules = (ctl_pfnEnumMemoryModules_t)GetProcAddress(hinstLibPtr, "ctlEnumMemoryModules"); if (pfnEnumMemoryModules) { result = pfnEnumMemoryModules(hDAhandle, pCount, phMemory); @@ -3199,9 +3406,11 @@ ctlMemoryGetProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnMemoryGetProperties_t pfnMemoryGetProperties = (ctl_pfnMemoryGetProperties_t)GetProcAddress(hinstLib, "ctlMemoryGetProperties"); + ctl_pfnMemoryGetProperties_t pfnMemoryGetProperties = (ctl_pfnMemoryGetProperties_t)GetProcAddress(hinstLibPtr, "ctlMemoryGetProperties"); if (pfnMemoryGetProperties) { result = pfnMemoryGetProperties(hMemory, pProperties); @@ -3237,9 +3446,11 @@ ctlMemoryGetState( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnMemoryGetState_t pfnMemoryGetState = (ctl_pfnMemoryGetState_t)GetProcAddress(hinstLib, "ctlMemoryGetState"); + ctl_pfnMemoryGetState_t pfnMemoryGetState = (ctl_pfnMemoryGetState_t)GetProcAddress(hinstLibPtr, "ctlMemoryGetState"); if (pfnMemoryGetState) { result = pfnMemoryGetState(hMemory, pState); @@ -3278,9 +3489,11 @@ ctlMemoryGetBandwidth( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnMemoryGetBandwidth_t pfnMemoryGetBandwidth = (ctl_pfnMemoryGetBandwidth_t)GetProcAddress(hinstLib, "ctlMemoryGetBandwidth"); + ctl_pfnMemoryGetBandwidth_t pfnMemoryGetBandwidth = (ctl_pfnMemoryGetBandwidth_t)GetProcAddress(hinstLibPtr, "ctlMemoryGetBandwidth"); if (pfnMemoryGetBandwidth) { result = pfnMemoryGetBandwidth(hMemory, pBandwidth); @@ -3312,9 +3525,11 @@ ctlOverclockGetProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockGetProperties_t pfnOverclockGetProperties = (ctl_pfnOverclockGetProperties_t)GetProcAddress(hinstLib, "ctlOverclockGetProperties"); + ctl_pfnOverclockGetProperties_t pfnOverclockGetProperties = (ctl_pfnOverclockGetProperties_t)GetProcAddress(hinstLibPtr, "ctlOverclockGetProperties"); if (pfnOverclockGetProperties) { result = pfnOverclockGetProperties(hDeviceHandle, pOcProperties); @@ -3356,9 +3571,11 @@ ctlOverclockWaiverSet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockWaiverSet_t pfnOverclockWaiverSet = (ctl_pfnOverclockWaiverSet_t)GetProcAddress(hinstLib, "ctlOverclockWaiverSet"); + ctl_pfnOverclockWaiverSet_t pfnOverclockWaiverSet = (ctl_pfnOverclockWaiverSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockWaiverSet"); if (pfnOverclockWaiverSet) { result = pfnOverclockWaiverSet(hDeviceHandle); @@ -3398,9 +3615,11 @@ ctlOverclockGpuFrequencyOffsetGet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockGpuFrequencyOffsetGet_t pfnOverclockGpuFrequencyOffsetGet = (ctl_pfnOverclockGpuFrequencyOffsetGet_t)GetProcAddress(hinstLib, "ctlOverclockGpuFrequencyOffsetGet"); + ctl_pfnOverclockGpuFrequencyOffsetGet_t pfnOverclockGpuFrequencyOffsetGet = (ctl_pfnOverclockGpuFrequencyOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuFrequencyOffsetGet"); if (pfnOverclockGpuFrequencyOffsetGet) { result = pfnOverclockGpuFrequencyOffsetGet(hDeviceHandle, pOcFrequencyOffset); @@ -3456,9 +3675,11 @@ ctlOverclockGpuFrequencyOffsetSet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockGpuFrequencyOffsetSet_t pfnOverclockGpuFrequencyOffsetSet = (ctl_pfnOverclockGpuFrequencyOffsetSet_t)GetProcAddress(hinstLib, "ctlOverclockGpuFrequencyOffsetSet"); + ctl_pfnOverclockGpuFrequencyOffsetSet_t pfnOverclockGpuFrequencyOffsetSet = (ctl_pfnOverclockGpuFrequencyOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuFrequencyOffsetSet"); if (pfnOverclockGpuFrequencyOffsetSet) { result = pfnOverclockGpuFrequencyOffsetSet(hDeviceHandle, ocFrequencyOffset); @@ -3498,9 +3719,11 @@ ctlOverclockGpuVoltageOffsetGet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockGpuVoltageOffsetGet_t pfnOverclockGpuVoltageOffsetGet = (ctl_pfnOverclockGpuVoltageOffsetGet_t)GetProcAddress(hinstLib, "ctlOverclockGpuVoltageOffsetGet"); + ctl_pfnOverclockGpuVoltageOffsetGet_t pfnOverclockGpuVoltageOffsetGet = (ctl_pfnOverclockGpuVoltageOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuVoltageOffsetGet"); if (pfnOverclockGpuVoltageOffsetGet) { result = pfnOverclockGpuVoltageOffsetGet(hDeviceHandle, pOcVoltageOffset); @@ -3544,9 +3767,11 @@ ctlOverclockGpuVoltageOffsetSet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockGpuVoltageOffsetSet_t pfnOverclockGpuVoltageOffsetSet = (ctl_pfnOverclockGpuVoltageOffsetSet_t)GetProcAddress(hinstLib, "ctlOverclockGpuVoltageOffsetSet"); + ctl_pfnOverclockGpuVoltageOffsetSet_t pfnOverclockGpuVoltageOffsetSet = (ctl_pfnOverclockGpuVoltageOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuVoltageOffsetSet"); if (pfnOverclockGpuVoltageOffsetSet) { result = pfnOverclockGpuVoltageOffsetSet(hDeviceHandle, ocVoltageOffset); @@ -3586,9 +3811,11 @@ ctlOverclockGpuLockGet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockGpuLockGet_t pfnOverclockGpuLockGet = (ctl_pfnOverclockGpuLockGet_t)GetProcAddress(hinstLib, "ctlOverclockGpuLockGet"); + ctl_pfnOverclockGpuLockGet_t pfnOverclockGpuLockGet = (ctl_pfnOverclockGpuLockGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuLockGet"); if (pfnOverclockGpuLockGet) { result = pfnOverclockGpuLockGet(hDeviceHandle, pVfPair); @@ -3632,9 +3859,11 @@ ctlOverclockGpuLockSet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockGpuLockSet_t pfnOverclockGpuLockSet = (ctl_pfnOverclockGpuLockSet_t)GetProcAddress(hinstLib, "ctlOverclockGpuLockSet"); + ctl_pfnOverclockGpuLockSet_t pfnOverclockGpuLockSet = (ctl_pfnOverclockGpuLockSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuLockSet"); if (pfnOverclockGpuLockSet) { result = pfnOverclockGpuLockSet(hDeviceHandle, vFPair); @@ -3670,9 +3899,11 @@ ctlOverclockVramFrequencyOffsetGet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockVramFrequencyOffsetGet_t pfnOverclockVramFrequencyOffsetGet = (ctl_pfnOverclockVramFrequencyOffsetGet_t)GetProcAddress(hinstLib, "ctlOverclockVramFrequencyOffsetGet"); + ctl_pfnOverclockVramFrequencyOffsetGet_t pfnOverclockVramFrequencyOffsetGet = (ctl_pfnOverclockVramFrequencyOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramFrequencyOffsetGet"); if (pfnOverclockVramFrequencyOffsetGet) { result = pfnOverclockVramFrequencyOffsetGet(hDeviceHandle, pOcFrequencyOffset); @@ -3743,9 +3974,11 @@ ctlOverclockVramFrequencyOffsetSet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockVramFrequencyOffsetSet_t pfnOverclockVramFrequencyOffsetSet = (ctl_pfnOverclockVramFrequencyOffsetSet_t)GetProcAddress(hinstLib, "ctlOverclockVramFrequencyOffsetSet"); + ctl_pfnOverclockVramFrequencyOffsetSet_t pfnOverclockVramFrequencyOffsetSet = (ctl_pfnOverclockVramFrequencyOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramFrequencyOffsetSet"); if (pfnOverclockVramFrequencyOffsetSet) { result = pfnOverclockVramFrequencyOffsetSet(hDeviceHandle, ocFrequencyOffset); @@ -3816,9 +4049,11 @@ ctlOverclockVramVoltageOffsetGet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockVramVoltageOffsetGet_t pfnOverclockVramVoltageOffsetGet = (ctl_pfnOverclockVramVoltageOffsetGet_t)GetProcAddress(hinstLib, "ctlOverclockVramVoltageOffsetGet"); + ctl_pfnOverclockVramVoltageOffsetGet_t pfnOverclockVramVoltageOffsetGet = (ctl_pfnOverclockVramVoltageOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramVoltageOffsetGet"); if (pfnOverclockVramVoltageOffsetGet) { result = pfnOverclockVramVoltageOffsetGet(hDeviceHandle, pVoltage); @@ -3856,9 +4091,11 @@ ctlOverclockVramVoltageOffsetSet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockVramVoltageOffsetSet_t pfnOverclockVramVoltageOffsetSet = (ctl_pfnOverclockVramVoltageOffsetSet_t)GetProcAddress(hinstLib, "ctlOverclockVramVoltageOffsetSet"); + ctl_pfnOverclockVramVoltageOffsetSet_t pfnOverclockVramVoltageOffsetSet = (ctl_pfnOverclockVramVoltageOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramVoltageOffsetSet"); if (pfnOverclockVramVoltageOffsetSet) { result = pfnOverclockVramVoltageOffsetSet(hDeviceHandle, voltage); @@ -3896,9 +4133,11 @@ ctlOverclockPowerLimitGet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockPowerLimitGet_t pfnOverclockPowerLimitGet = (ctl_pfnOverclockPowerLimitGet_t)GetProcAddress(hinstLib, "ctlOverclockPowerLimitGet"); + ctl_pfnOverclockPowerLimitGet_t pfnOverclockPowerLimitGet = (ctl_pfnOverclockPowerLimitGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockPowerLimitGet"); if (pfnOverclockPowerLimitGet) { result = pfnOverclockPowerLimitGet(hDeviceHandle, pSustainedPowerLimit); @@ -3936,9 +4175,11 @@ ctlOverclockPowerLimitSet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockPowerLimitSet_t pfnOverclockPowerLimitSet = (ctl_pfnOverclockPowerLimitSet_t)GetProcAddress(hinstLib, "ctlOverclockPowerLimitSet"); + ctl_pfnOverclockPowerLimitSet_t pfnOverclockPowerLimitSet = (ctl_pfnOverclockPowerLimitSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockPowerLimitSet"); if (pfnOverclockPowerLimitSet) { result = pfnOverclockPowerLimitSet(hDeviceHandle, sustainedPowerLimit); @@ -3973,9 +4214,11 @@ ctlOverclockTemperatureLimitGet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockTemperatureLimitGet_t pfnOverclockTemperatureLimitGet = (ctl_pfnOverclockTemperatureLimitGet_t)GetProcAddress(hinstLib, "ctlOverclockTemperatureLimitGet"); + ctl_pfnOverclockTemperatureLimitGet_t pfnOverclockTemperatureLimitGet = (ctl_pfnOverclockTemperatureLimitGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockTemperatureLimitGet"); if (pfnOverclockTemperatureLimitGet) { result = pfnOverclockTemperatureLimitGet(hDeviceHandle, pTemperatureLimit); @@ -4010,9 +4253,11 @@ ctlOverclockTemperatureLimitSet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockTemperatureLimitSet_t pfnOverclockTemperatureLimitSet = (ctl_pfnOverclockTemperatureLimitSet_t)GetProcAddress(hinstLib, "ctlOverclockTemperatureLimitSet"); + ctl_pfnOverclockTemperatureLimitSet_t pfnOverclockTemperatureLimitSet = (ctl_pfnOverclockTemperatureLimitSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockTemperatureLimitSet"); if (pfnOverclockTemperatureLimitSet) { result = pfnOverclockTemperatureLimitSet(hDeviceHandle, temperatureLimit); @@ -4048,9 +4293,11 @@ ctlPowerTelemetryGet( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPowerTelemetryGet_t pfnPowerTelemetryGet = (ctl_pfnPowerTelemetryGet_t)GetProcAddress(hinstLib, "ctlPowerTelemetryGet"); + ctl_pfnPowerTelemetryGet_t pfnPowerTelemetryGet = (ctl_pfnPowerTelemetryGet_t)GetProcAddress(hinstLibPtr, "ctlPowerTelemetryGet"); if (pfnPowerTelemetryGet) { result = pfnPowerTelemetryGet(hDeviceHandle, pTelemetryInfo); @@ -4086,9 +4333,11 @@ ctlOverclockResetToDefault( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnOverclockResetToDefault_t pfnOverclockResetToDefault = (ctl_pfnOverclockResetToDefault_t)GetProcAddress(hinstLib, "ctlOverclockResetToDefault"); + ctl_pfnOverclockResetToDefault_t pfnOverclockResetToDefault = (ctl_pfnOverclockResetToDefault_t)GetProcAddress(hinstLibPtr, "ctlOverclockResetToDefault"); if (pfnOverclockResetToDefault) { result = pfnOverclockResetToDefault(hDeviceHandle); @@ -4124,9 +4373,11 @@ ctlPciGetProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPciGetProperties_t pfnPciGetProperties = (ctl_pfnPciGetProperties_t)GetProcAddress(hinstLib, "ctlPciGetProperties"); + ctl_pfnPciGetProperties_t pfnPciGetProperties = (ctl_pfnPciGetProperties_t)GetProcAddress(hinstLibPtr, "ctlPciGetProperties"); if (pfnPciGetProperties) { result = pfnPciGetProperties(hDAhandle, pProperties); @@ -4162,9 +4413,11 @@ ctlPciGetState( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPciGetState_t pfnPciGetState = (ctl_pfnPciGetState_t)GetProcAddress(hinstLib, "ctlPciGetState"); + ctl_pfnPciGetState_t pfnPciGetState = (ctl_pfnPciGetState_t)GetProcAddress(hinstLibPtr, "ctlPciGetState"); if (pfnPciGetState) { result = pfnPciGetState(hDAhandle, pState); @@ -4210,9 +4463,11 @@ ctlEnumPowerDomains( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumPowerDomains_t pfnEnumPowerDomains = (ctl_pfnEnumPowerDomains_t)GetProcAddress(hinstLib, "ctlEnumPowerDomains"); + ctl_pfnEnumPowerDomains_t pfnEnumPowerDomains = (ctl_pfnEnumPowerDomains_t)GetProcAddress(hinstLibPtr, "ctlEnumPowerDomains"); if (pfnEnumPowerDomains) { result = pfnEnumPowerDomains(hDAhandle, pCount, phPower); @@ -4248,9 +4503,11 @@ ctlPowerGetProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPowerGetProperties_t pfnPowerGetProperties = (ctl_pfnPowerGetProperties_t)GetProcAddress(hinstLib, "ctlPowerGetProperties"); + ctl_pfnPowerGetProperties_t pfnPowerGetProperties = (ctl_pfnPowerGetProperties_t)GetProcAddress(hinstLibPtr, "ctlPowerGetProperties"); if (pfnPowerGetProperties) { result = pfnPowerGetProperties(hPower, pProperties); @@ -4287,9 +4544,11 @@ ctlPowerGetEnergyCounter( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPowerGetEnergyCounter_t pfnPowerGetEnergyCounter = (ctl_pfnPowerGetEnergyCounter_t)GetProcAddress(hinstLib, "ctlPowerGetEnergyCounter"); + ctl_pfnPowerGetEnergyCounter_t pfnPowerGetEnergyCounter = (ctl_pfnPowerGetEnergyCounter_t)GetProcAddress(hinstLibPtr, "ctlPowerGetEnergyCounter"); if (pfnPowerGetEnergyCounter) { result = pfnPowerGetEnergyCounter(hPower, pEnergy); @@ -4323,9 +4582,11 @@ ctlPowerGetLimits( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPowerGetLimits_t pfnPowerGetLimits = (ctl_pfnPowerGetLimits_t)GetProcAddress(hinstLib, "ctlPowerGetLimits"); + ctl_pfnPowerGetLimits_t pfnPowerGetLimits = (ctl_pfnPowerGetLimits_t)GetProcAddress(hinstLibPtr, "ctlPowerGetLimits"); if (pfnPowerGetLimits) { result = pfnPowerGetLimits(hPower, pPowerLimits); @@ -4363,9 +4624,11 @@ ctlPowerSetLimits( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnPowerSetLimits_t pfnPowerSetLimits = (ctl_pfnPowerSetLimits_t)GetProcAddress(hinstLib, "ctlPowerSetLimits"); + ctl_pfnPowerSetLimits_t pfnPowerSetLimits = (ctl_pfnPowerSetLimits_t)GetProcAddress(hinstLibPtr, "ctlPowerSetLimits"); if (pfnPowerSetLimits) { result = pfnPowerSetLimits(hPower, pPowerLimits); @@ -4411,9 +4674,11 @@ ctlEnumTemperatureSensors( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnEnumTemperatureSensors_t pfnEnumTemperatureSensors = (ctl_pfnEnumTemperatureSensors_t)GetProcAddress(hinstLib, "ctlEnumTemperatureSensors"); + ctl_pfnEnumTemperatureSensors_t pfnEnumTemperatureSensors = (ctl_pfnEnumTemperatureSensors_t)GetProcAddress(hinstLibPtr, "ctlEnumTemperatureSensors"); if (pfnEnumTemperatureSensors) { result = pfnEnumTemperatureSensors(hDAhandle, pCount, phTemperature); @@ -4449,9 +4714,11 @@ ctlTemperatureGetProperties( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnTemperatureGetProperties_t pfnTemperatureGetProperties = (ctl_pfnTemperatureGetProperties_t)GetProcAddress(hinstLib, "ctlTemperatureGetProperties"); + ctl_pfnTemperatureGetProperties_t pfnTemperatureGetProperties = (ctl_pfnTemperatureGetProperties_t)GetProcAddress(hinstLibPtr, "ctlTemperatureGetProperties"); if (pfnTemperatureGetProperties) { result = pfnTemperatureGetProperties(hTemperature, pProperties); @@ -4488,9 +4755,11 @@ ctlTemperatureGetState( ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - if (NULL != hinstLib) + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) { - ctl_pfnTemperatureGetState_t pfnTemperatureGetState = (ctl_pfnTemperatureGetState_t)GetProcAddress(hinstLib, "ctlTemperatureGetState"); + ctl_pfnTemperatureGetState_t pfnTemperatureGetState = (ctl_pfnTemperatureGetState_t)GetProcAddress(hinstLibPtr, "ctlTemperatureGetState"); if (pfnTemperatureGetState) { result = pfnTemperatureGetState(hTemperature, pTemperature); From b8e0fa0a3c790e6e82ad9a64ad238b688f502318 Mon Sep 17 00:00:00 2001 From: SameerKP Date: Thu, 14 Mar 2024 08:23:49 -0700 Subject: [PATCH 03/26] Update README.md Updating minor version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12f3e4b..af33579 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Intel Graphics Control Library (IGCL) -Header, wrapper library and samples of IGCL version 1.0 +Header, wrapper library and samples of IGCL version 1.1 # Introduction From f217ec3845c5a7a5e156f242a1fe6b3647d484b7 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Wed, 13 Mar 2024 21:18:32 +0530 Subject: [PATCH 04/26] Folder name update --- {wrapper => Source}/cApiWrapper.cpp | 0 {includes => include}/igcl_api.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {wrapper => Source}/cApiWrapper.cpp (100%) rename {includes => include}/igcl_api.h (100%) diff --git a/wrapper/cApiWrapper.cpp b/Source/cApiWrapper.cpp similarity index 100% rename from wrapper/cApiWrapper.cpp rename to Source/cApiWrapper.cpp diff --git a/includes/igcl_api.h b/include/igcl_api.h similarity index 100% rename from includes/igcl_api.h rename to include/igcl_api.h From 0f5f3ecf0f1e0dd8824541d0d647611385ac6523 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Mon, 22 Apr 2024 20:36:12 +0530 Subject: [PATCH 05/26] Updated version to v192 --- README.md | 2 +- .../3D_Feature_Sample_App.cpp | 13 +- Samples/Color_Samples/Color_Sample_App.cpp | 27 +- .../CombinedDisplay_Sample_App.cpp | 2 +- .../CustomMode_Sample_App.cpp | 6 +- .../DisplayGenlock_Sample_App.cpp | 13 +- Samples/DisplaySettings/CMakeLists.txt | 22 + .../DisplaySettings_Sample_App.cpp | 519 ++ Samples/DisplaySettings/README.md | 1 + Samples/Generic_Sample/Sample_ControlAPP.cpp | 51 +- Samples/Media_Samples/Media_Sample_App.cpp | 1 - .../PowerFeature_Sample_App.cpp | 70 + Samples/Scaling_Samples/Scaling_App.cpp | 97 +- .../Telemetry_Samples/Sample_TelemetryAPP.cpp | 130 +- Samples/inc/GenericIGCLApp.h | 4 +- Source/cApiWrapper.cpp | 18 +- Source/igcl_api.h | 7906 +++++++++++++++++ include/cApiWrapper.cpp | 4776 ++++++++++ include/igcl_api.h | 16 +- 19 files changed, 13601 insertions(+), 73 deletions(-) create mode 100644 Samples/DisplaySettings/CMakeLists.txt create mode 100644 Samples/DisplaySettings/DisplaySettings_Sample_App.cpp create mode 100644 Samples/DisplaySettings/README.md create mode 100644 Source/igcl_api.h create mode 100644 include/cApiWrapper.cpp diff --git a/README.md b/README.md index af33579..12f3e4b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Intel Graphics Control Library (IGCL) -Header, wrapper library and samples of IGCL version 1.1 +Header, wrapper library and samples of IGCL version 1.0 # Introduction diff --git a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp index e618b5c..79c2f9c 100644 --- a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp +++ b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp @@ -367,6 +367,11 @@ ctl_result_t CtlGet3DFeatureCaps(ctl_device_adapter_handle_t hDevices) { printf("ctlGetSupported3DCapabilities returned success\n"); FeatureCaps3D.pFeatureDetails = (ctl_3d_feature_details_t *)malloc(sizeof(ctl_3d_feature_details_t) * FeatureCaps3D.NumSupportedFeatures); + if (FeatureCaps3D.pFeatureDetails == NULL) + { + return CTL_RESULT_ERROR_INVALID_NULL_POINTER; + } + memset(FeatureCaps3D.pFeatureDetails, 0x0, sizeof(ctl_3d_feature_details_t) * FeatureCaps3D.NumSupportedFeatures); Result = ctlGetSupported3DCapabilities(hDevices, &FeatureCaps3D); if (Result == CTL_RESULT_SUCCESS) @@ -407,11 +412,9 @@ ctl_result_t CtlGet3DFeatureCaps(ctl_device_adapter_handle_t hDevices) } return Result; } - if (nullptr != FeatureCaps3D.pFeatureDetails) - { - free(FeatureCaps3D.pFeatureDetails); - FeatureCaps3D.pFeatureDetails = nullptr; - } + + free(FeatureCaps3D.pFeatureDetails); + FeatureCaps3D.pFeatureDetails = nullptr; } } diff --git a/Samples/Color_Samples/Color_Sample_App.cpp b/Samples/Color_Samples/Color_Sample_App.cpp index d952301..9a729e8 100644 --- a/Samples/Color_Samples/Color_Sample_App.cpp +++ b/Samples/Color_Samples/Color_Sample_App.cpp @@ -1287,6 +1287,7 @@ ctl_result_t SetGammaLut(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_p SetPixTxArgs.pBlockConfigs = &LutConfig; // for 1DLUT block double *pRedLut, *pGreenLut, *pBlueLut; + double LutMultiplier; // Create a valid 1D LUT. const uint32_t LutSize = LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels; @@ -1298,10 +1299,30 @@ ctl_result_t SetGammaLut(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_p pGreenLut = pRedLut + LutConfig.Config.OneDLutConfig.NumSamplesPerChannel; pBlueLut = pGreenLut + LutConfig.Config.OneDLutConfig.NumSamplesPerChannel; - for (uint32_t i = 0; i < (LutSize / LutConfig.Config.OneDLutConfig.NumChannels); i++) + // Applying a LUT which reduces the Red channel values by 30%.in linear format + // Based on the Pixel Encoding type , encode the multiplier 0.7 with the same function + // For example if Encoding is ST2084 then OETF2084(0.7) -> 0.962416136 + // if Encoding is SRGB then sRGB(0.7) -> 0.854305832 + + if (CTL_PIXTX_GAMMA_ENCODING_TYPE_ST2084 == pPixTxCaps->OutputPixelFormat.EncodingType) { - double Input = (double)i / (double)(LutSize / LutConfig.Config.OneDLutConfig.NumChannels - 1); - pRedLut[i] = pGreenLut[i] = pBlueLut[i] = GetSRGBEncodingValue(Input); + LutMultiplier = 0.962416136; + } + else if (CTL_PIXTX_GAMMA_ENCODING_TYPE_SRGB == pPixTxCaps->OutputPixelFormat.EncodingType) + { + LutMultiplier = 0.854305832; + } + else + { + LutMultiplier = 1.0; + } + + // When calling Set for just OneDLUT the LUT is expected to be a Relative Correction LUT + for (uint32_t i = 0; i < LutConfig.Config.OneDLutConfig.NumSamplesPerChannel; i++) + { + double Input = (double)i / (double)(LutConfig.Config.OneDLutConfig.NumSamplesPerChannel - 1); + pRedLut[i] = pGreenLut[i] = pBlueLut[i] = Input; + pRedLut[i] *= LutMultiplier; } Result = ctlPixelTransformationSetConfig(hDisplayOutput, &SetPixTxArgs); diff --git a/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp b/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp index 3bc1ab3..643bdd6 100644 --- a/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp +++ b/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp @@ -338,7 +338,7 @@ ctl_result_t ParseDisplayOrderArguments(uint8_t NumOutputs, const char *pCDArgFi break; } } - Order = Value; + Order = move(Value); SelectedDisplays[Index] = stoi(Order); break; } diff --git a/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp b/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp index 6d06d12..c7a7217 100644 --- a/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp +++ b/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp @@ -80,7 +80,7 @@ ctl_result_t GetCustomModes(ctl_display_output_handle_t hDisplayOutput) EXIT_ON_MEM_ALLOC_FAILURE(pCustomSourceModes, "pCustomSourceModes"); - memset(pCustomSourceModes, 0, sizeof(pCustomSourceModes)); + memset(pCustomSourceModes, 0, pCustomModeSourceSize); GetCustomModes.NumOfModes = NumOfCustomModes; GetCustomModes.CustomModeOpType = CTL_CUSTOM_MODE_OPERATION_TYPES_GET_CUSTOM_SOURCE_MODES; @@ -124,7 +124,7 @@ ctl_result_t AddCustomModes(ctl_display_output_handle_t hDisplayOutput, uint32_t EXIT_ON_MEM_ALLOC_FAILURE(pCustomSourceMode, "pCustomSourceMode"); - memset(pCustomSourceMode, 0, sizeof(pCustomSourceMode)); + memset(pCustomSourceMode, 0, sizeof(ctl_custom_src_mode_t)); AddCustomMode.NumOfModes = 1; AddCustomMode.CustomModeOpType = CTL_CUSTOM_MODE_OPERATION_TYPES_ADD_CUSTOM_SOURCE_MODE; @@ -172,7 +172,7 @@ ctl_result_t RemoveCustomModes(ctl_display_output_handle_t hDisplayOutput) EXIT_ON_MEM_ALLOC_FAILURE(pCustomSourceModes, "pCustomSourceModes"); - memset(pCustomSourceModes, 0, sizeof(pCustomSourceModes)); + memset(pCustomSourceModes, 0, pCustomModeSourceSize); RemoveCustomModes.NumOfModes = NumOfModesToRemove; RemoveCustomModes.CustomModeOpType = CTL_CUSTOM_MODE_OPERATION_TYPES_REMOVE_CUSTOM_SOURCE_MODES; diff --git a/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp b/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp index e5b61a0..cd497be 100644 --- a/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp +++ b/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp @@ -777,12 +777,15 @@ ctl_result_t GenlockEnable(ctl_device_adapter_handle_t *hDevices, uint32_t Adapt LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockEnable - Primary"); // Enabling secondary adapters - GenlockSampleArgs.IsGenlockPrimary = false; - Result = InitGenlockArgs(hSecondaryAdapters, SecondaryAdapterCount, GenlockSampleArgs, pGenlockArgs); - LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs for secondary adapters"); + if (SecondaryAdapterCount > 0) + { + GenlockSampleArgs.IsGenlockPrimary = false; + Result = InitGenlockArgs(hSecondaryAdapters, SecondaryAdapterCount, GenlockSampleArgs, pGenlockArgs); + LOG_AND_EXIT_ON_ERROR(Result, "InitGenlockArgs for secondary adapters"); - Result = TestGenlockEnable(hSecondaryAdapters, pGenlockArgs, SecondaryAdapterCount); - LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockEnable - Secondary"); + Result = TestGenlockEnable(hSecondaryAdapters, pGenlockArgs, SecondaryAdapterCount); + LOG_AND_EXIT_ON_ERROR(Result, "TestGenlockEnable - Secondary"); + } } else { diff --git a/Samples/DisplaySettings/CMakeLists.txt b/Samples/DisplaySettings/CMakeLists.txt new file mode 100644 index 0000000..43ce6d4 --- /dev/null +++ b/Samples/DisplaySettings/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +set(TARGET_NAME DisplaySettings) +get_filename_component(ROOT_DIR ../../ ABSOLUTE) +project(DisplaySettings VERSION 1.0) +add_executable(${TARGET_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/DisplaySettings_Sample_App.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp +) + +if(MSVC) + set_target_properties(${TARGET_NAME} + PROPERTIES + VS_DEBUGGER_COMMAND_ARGUMENTS "" + VS_DEBUGGER_WORKING_DIRECTORY "$(OutDir)" + ) + + ADD_DEFINITIONS(-DUNICODE) + ADD_DEFINITIONS(-D_UNICODE) +endif() + +include_directories(${ROOT_DIR}/include) +include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp b/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp new file mode 100644 index 0000000..6d60d6b --- /dev/null +++ b/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp @@ -0,0 +1,519 @@ +//=========================================================================== +// Copyright (C) 2022 Intel Corporation +// +// +// +// SPDX-License-Identifier: MIT +//-------------------------------------------------------------------------- + +/** + * + * @file DisplaySettings_Sample_App.cpp + * @brief : This file contains the 'main' function and the DisplaySettings Sample APP. Program execution begins and ends there. + * + */ + +#define _CRTDBG_MAP_ALLOC +#include +#include +#include +#include +#include +#include + +#define CTL_APIEXPORT // caller of control API DLL shall define this before + // including igcl_api.h +#include "igcl_api.h" +#include "GenericIGCLApp.h" + +#define API_VERSION 0; + +ctl_result_t GResult = CTL_RESULT_SUCCESS; + +/*************************************************************** + * @brief + * Sample test for Get/Set Quantization Range + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestToGetSetQuantizationRange(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_display_settings_t AppliedDisplaySettings = { 0 }; + ctl_display_settings_t NewDisplaySettings = { 0 }; + bool IsControllable, IsSupported = FALSE; + + // GET CALL + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Quantization Range GET CALL)"); + + IsControllable = (CTL_DISPLAY_SETTING_FLAG_QUANTIZATION_RANGE & AppliedDisplaySettings.ControllableFlags) ? TRUE : FALSE; + IsSupported = (CTL_DISPLAY_SETTING_FLAG_QUANTIZATION_RANGE & AppliedDisplaySettings.SupportedFlags) ? TRUE : FALSE; + + if ((FALSE == IsControllable) || (FALSE == IsSupported)) + { + printf("Get/Set Quantization Range is not supported\n"); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + + printf("\n Current Applied Quantization Range is %d \n", AppliedDisplaySettings.QuantizationRange); + + // SET CALL + NewDisplaySettings.Version = API_VERSION; + NewDisplaySettings.Size = sizeof(ctl_display_settings_t); + NewDisplaySettings.Set = TRUE; + + NewDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_QUANTIZATION_RANGE; + NewDisplaySettings.QuantizationRange = CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_FULL_RANGE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &NewDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Quantization Range SET CALL)"); + + // GET CALL + AppliedDisplaySettings = { 0 }; + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Quantization Range GET CALL)"); + printf("\n Current Quantization Range is %d \n", AppliedDisplaySettings.QuantizationRange); + +Exit: + return Result; +} + +/*************************************************************** + * @brief + * Sample test for Get/Set PictureAspectRatio + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestToGetSetPictureAspectRatio(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_display_settings_t AppliedDisplaySettings = { 0 }; + ctl_display_settings_t NewDisplaySettings = { 0 }; + bool IsControllable, IsSupported = FALSE; + + // GET CALL + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Picture Aspect Ratio GET CALL)"); + + IsControllable = (CTL_DISPLAY_SETTING_FLAG_PICTURE_AR & AppliedDisplaySettings.ControllableFlags) ? TRUE : FALSE; + IsSupported = (CTL_DISPLAY_SETTING_FLAG_PICTURE_AR & AppliedDisplaySettings.SupportedFlags) ? TRUE : FALSE; + + if ((FALSE == IsControllable) || (FALSE == IsSupported)) + { + printf("Get/Set PictureAspectRatio is not supported\n"); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + + printf("\n Supported Picture Aspect Ratio is %d \n", AppliedDisplaySettings.SupportedPictureAR); + printf("\n Current Applied Picture Aspect Ratio is %d \n", AppliedDisplaySettings.PictureAR); + + // CALL TO SET 16_9 + if (CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_16_9 & AppliedDisplaySettings.SupportedPictureAR) + { + + NewDisplaySettings.Version = API_VERSION; + NewDisplaySettings.Size = sizeof(ctl_display_settings_t); + NewDisplaySettings.Set = TRUE; + + NewDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_PICTURE_AR; + NewDisplaySettings.PictureAR = CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_16_9; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &NewDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Picture Aspect Ratio SET CALL)"); + } + + // GET CALL + AppliedDisplaySettings = { 0 }; + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Picture Aspect Ratio GET CALL)"); + printf("\n Current Picture Aspect Ratio is %d \n", AppliedDisplaySettings.PictureAR); + +Exit: + return Result; +} + +/*************************************************************** + * @brief + * Sample test for Get/Set ContentType + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestToGetSetContentType(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_display_settings_t AppliedDisplaySettings = { 0 }; + ctl_display_settings_t NewDisplaySettings = { 0 }; + bool IsControllable, IsSupported = FALSE; + + // GET CALL + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (ContentType GET CALL)"); + + IsControllable = (CTL_DISPLAY_SETTING_FLAG_CONTENT_TYPE & AppliedDisplaySettings.ControllableFlags) ? TRUE : FALSE; + IsSupported = (CTL_DISPLAY_SETTING_FLAG_CONTENT_TYPE & AppliedDisplaySettings.SupportedFlags) ? TRUE : FALSE; + + if ((FALSE == IsControllable) || (FALSE == IsSupported)) + { + printf("Get/Set ContentType is not supported\n"); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + + printf("\n Current Applied ContentType is %d \n", AppliedDisplaySettings.ContentType); + + // CALL TO SET GAMING CONTENT TYPE + NewDisplaySettings.Version = API_VERSION; + NewDisplaySettings.Size = sizeof(ctl_display_settings_t); + NewDisplaySettings.Set = TRUE; + + NewDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_CONTENT_TYPE; + NewDisplaySettings.ContentType = CTL_DISPLAY_SETTING_CONTENT_TYPE_GAMING; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &NewDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (ContentType SET CALL)"); + + // GET CALL + AppliedDisplaySettings = { 0 }; + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (ContentType GET CALL)"); + printf("\n Current ContentType is %d \n", AppliedDisplaySettings.ContentType); + +Exit: + return Result; +} + +/*************************************************************** + * @brief + * Sample test for Get/Set LowLatency + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestToGetSetLowLatency(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_display_settings_t AppliedDisplaySettings = { 0 }; + ctl_display_settings_t NewDisplaySettings = { 0 }; + bool IsControllable, IsSupported = FALSE; + + // GET CALL + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (LowLatency GET CALL)"); + + IsControllable = (CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY & AppliedDisplaySettings.ControllableFlags) ? TRUE : FALSE; + IsSupported = (CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY & AppliedDisplaySettings.SupportedFlags) ? TRUE : FALSE; + + if ((FALSE == IsControllable) || (FALSE == IsSupported)) + { + printf("Get/Set LowLatency is not supported\n"); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + + printf("\n Current Applied LowLatency is %d \n", AppliedDisplaySettings.LowLatency); + + // CALL TO ENABLE HDR10+ LOW_LATENCY + NewDisplaySettings.Version = API_VERSION; + NewDisplaySettings.Size = sizeof(ctl_display_settings_t); + NewDisplaySettings.Set = TRUE; + + NewDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY; + NewDisplaySettings.LowLatency = CTL_DISPLAY_SETTING_LOW_LATENCY_ENABLED; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &NewDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (LowLatency SET CALL)"); + + // GET CALL + AppliedDisplaySettings = { 0 }; + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (LowLatency GET CALL)"); + printf("\n Current LowLatency is %d \n", AppliedDisplaySettings.LowLatency); + +Exit: + return Result; +} + +/*************************************************************** + * @brief + * Sample test for Get/Set SourceTonemapping + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestToGetSetSourceTonemapping(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_display_settings_t AppliedDisplaySettings = { 0 }; + ctl_display_settings_t NewDisplaySettings = { 0 }; + bool IsControllable, IsSupported = FALSE; + + // GET CALL + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (SourceTM GET CALL)"); + + IsControllable = (CTL_DISPLAY_SETTING_FLAG_SOURCE_TM & AppliedDisplaySettings.ControllableFlags) ? TRUE : FALSE; + IsSupported = (CTL_DISPLAY_SETTING_FLAG_SOURCE_TM & AppliedDisplaySettings.SupportedFlags) ? TRUE : FALSE; + + if ((FALSE == IsControllable) || (FALSE == IsSupported)) + { + printf("Get/Set SourceTM is not supported\n"); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + + printf("\n Current Applied SourceTM is %d \n", AppliedDisplaySettings.SourceTM); + + // CALL TO ENABLE HDR10+ SOURCETM + NewDisplaySettings.Version = API_VERSION; + NewDisplaySettings.Size = sizeof(ctl_display_settings_t); + NewDisplaySettings.Set = TRUE; + + NewDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_SOURCE_TM; + NewDisplaySettings.SourceTM = CTL_DISPLAY_SETTING_SOURCETM_ENABLED; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &NewDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (SourceTM SET CALL)"); + + // GET CALL + AppliedDisplaySettings = { 0 }; + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (SourceTM GET CALL)"); + printf("\n Current SourceTM is %d \n", AppliedDisplaySettings.SourceTM); + +Exit: + return Result; +} + +/*************************************************************** + * @brief EnumerateDisplayHandles + * Only for demonstration purpose, API is called for each of the display output handle in below snippet. + * User has to filter through the available display output handle and has to call the API with particular display output handle. + * @param hDisplayOutput, DisplayCount + * @return ctl_result_t + ***************************************************************/ +ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput, uint32_t DisplayCount) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + + for (uint32_t DisplayIndex = 0; DisplayIndex < DisplayCount; DisplayIndex++) + { + ctl_display_properties_t DisplayProperties = {}; + DisplayProperties.Size = sizeof(ctl_display_properties_t); + + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput[DisplayIndex], "hDisplayOutput"); + + Result = ctlGetDisplayProperties(hDisplayOutput[DisplayIndex], &DisplayProperties); + + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetDisplayProperties"); + + bool IsDisplayAttached = DisplayProperties.DisplayConfigFlags & CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ATTACHED; + + if (FALSE == IsDisplayAttached) + { + continue; + } + + printf("Attached Display Count: %d\n", DisplayIndex); + + // Get/Set Quantization Range + Result = TestToGetSetQuantizationRange(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + + // Get/Set Picture Aspect Ratio + Result = TestToGetSetPictureAspectRatio(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + + // Get/Set Content type + Result = TestToGetSetContentType(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + + // Get/Set HDR10+ Low Latency Flag + Result = TestToGetSetLowLatency(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + + // Get/Set HDR10+ Source Tonemapping Flag + Result = TestToGetSetSourceTonemapping(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + } + +Exit: + return Result; +} + +/*************************************************************** + * @brief EnumerateTargetDisplays + * Enumerates all the possible target display's for the adapters + * @param hDisplayOutput, AdapterCount, hDevices + * @return ctl_result_t + ***************************************************************/ +ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput, uint32_t AdapterCount, ctl_device_adapter_handle_t *hDevices) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + uint32_t DisplayCount = 0; + + for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) + { + // enumerate all the possible target display's for the adapters + // first step is to get the count + DisplayCount = 0; + + Result = ctlEnumerateDisplayOutputs(hDevices[AdapterIndex], &DisplayCount, hDisplayOutput); + + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + STORE_AND_RESET_ERROR(Result); + continue; + } + else if (DisplayCount <= 0) + { + printf("Invalid Display Count. skipping display enumration for adapter:%d\n", AdapterIndex); + continue; + } + + hDisplayOutput = (ctl_display_output_handle_t *)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevices[AdapterIndex], &DisplayCount, hDisplayOutput); + + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + STORE_AND_RESET_ERROR(Result); + } + + // Only for demonstration purpose, API is called for each of the display output handle in below snippet. + // User has to filter through the available display output handle and has to call the API with particular display output handle. + Result = EnumerateDisplayHandles(hDisplayOutput, DisplayCount); + + if (CTL_RESULT_SUCCESS != Result) + { + printf("EnumerateDisplayHandles returned failure code: 0x%X\n", Result); + } + + CTL_FREE_MEM(hDisplayOutput); + } + +Exit: + + CTL_FREE_MEM(hDisplayOutput); + return Result; +} + +/*************************************************************** + * @brief Main Function which calls the Sample Display Settings API + * @param + * @return int + ***************************************************************/ +int main() +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_device_adapter_handle_t *hDevices = NULL; + ctl_display_output_handle_t *hDisplayOutput = NULL; + ctl_device_adapter_properties_t DeviceAdapterProperties = { 0 }; + // Get a handle to the DLL module. + uint32_t AdapterCount = 0; + uint32_t DisplayCount = 0; + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + + ctl_init_args_t CtlInitArgs; + ctl_api_handle_t hAPIHandle; + CtlInitArgs.AppVersion = CTL_MAKE_VERSION(CTL_IMPL_MAJOR_VERSION, CTL_IMPL_MINOR_VERSION); + CtlInitArgs.flags = 0; + CtlInitArgs.Size = sizeof(CtlInitArgs); + CtlInitArgs.Version = 0; + ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); + + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + + // Initialization successful + // Get the list of Intel Adapters + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + + hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "hDevices"); + + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + + Result = EnumerateTargetDisplays(hDisplayOutput, AdapterCount, hDevices); + + if (CTL_RESULT_SUCCESS != Result) + { + printf("EnumerateTargetDisplays returned failure code: 0x%X\n", Result); + STORE_AND_RESET_ERROR(Result); + } + +Exit: + + ctlClose(hAPIHandle); + CTL_FREE_MEM(hDisplayOutput); + CTL_FREE_MEM(hDevices); + printf("Overrall test result is 0x%X\n", GResult); + return GResult; +} diff --git a/Samples/DisplaySettings/README.md b/Samples/DisplaySettings/README.md new file mode 100644 index 0000000..02ef053 --- /dev/null +++ b/Samples/DisplaySettings/README.md @@ -0,0 +1 @@ +Sample Application for Display Settings interfaces \ No newline at end of file diff --git a/Samples/Generic_Sample/Sample_ControlAPP.cpp b/Samples/Generic_Sample/Sample_ControlAPP.cpp index e1bfbce..dc5f8cf 100644 --- a/Samples/Generic_Sample/Sample_ControlAPP.cpp +++ b/Samples/Generic_Sample/Sample_ControlAPP.cpp @@ -319,6 +319,11 @@ ctl_result_t CtlGet3DGlobalTest(ctl_device_adapter_handle_t hDevices) { printf("ctlGetSupported3DCapabilities returned success. No of gaming features = %d\n", FeatureCaps3D.NumSupportedFeatures); FeatureCaps3D.pFeatureDetails = (ctl_3d_feature_details_t *)malloc(sizeof(ctl_3d_feature_details_t) * FeatureCaps3D.NumSupportedFeatures); + if (FeatureCaps3D.pFeatureDetails == NULL) + { + return CTL_RESULT_ERROR_INVALID_NULL_POINTER; + } + memset(FeatureCaps3D.pFeatureDetails, 0x0, sizeof(ctl_3d_feature_details_t) * FeatureCaps3D.NumSupportedFeatures); Result = ctlGetSupported3DCapabilities(hDevices, &FeatureCaps3D); if (Result == CTL_RESULT_SUCCESS) @@ -656,39 +661,39 @@ ctl_result_t CtlTestEvents(ctl_device_adapter_handle_t hAdapter) * @param * @return ***************************************************************/ -void PrintAdapterProperties(ctl_device_adapter_properties_t StDeviceAdapterProperties) +void PrintAdapterProperties(ctl_device_adapter_properties_t *pStDeviceAdapterProperties) { char DriverVersion[25] = ""; LARGE_INTEGER LIDriverVersion; - LIDriverVersion.QuadPart = StDeviceAdapterProperties.driver_version; + LIDriverVersion.QuadPart = pStDeviceAdapterProperties->driver_version; sprintf(DriverVersion, "%d.%d.%d.%d", HIWORD(LIDriverVersion.HighPart), LOWORD(LIDriverVersion.HighPart), HIWORD(LIDriverVersion.LowPart), LOWORD(LIDriverVersion.LowPart)); printf("Intel Graphics Driver Version : %s\n", DriverVersion); - printf("GOP Version : %lld.%lld.%lld\n", StDeviceAdapterProperties.firmware_version.major_version, StDeviceAdapterProperties.firmware_version.minor_version, - StDeviceAdapterProperties.firmware_version.build_number); - - printf("Intel Adapter Name: %s\n", StDeviceAdapterProperties.name); - printf("Vendor ID: 0x%X\n", StDeviceAdapterProperties.pci_vendor_id); - printf("Device ID: 0x%X\n", StDeviceAdapterProperties.pci_device_id); - printf("SubSys id 0x%X\n", StDeviceAdapterProperties.pci_subsys_id); - printf("SubSys Vendor id 0x%X\n", StDeviceAdapterProperties.pci_subsys_vendor_id); - printf("Rev ID: 0x%X\n", StDeviceAdapterProperties.rev_id); - printf("Graphics Frequency: %dMHz\n", StDeviceAdapterProperties.Frequency); - printf("num_eus_per_sub_slice: %d\n", StDeviceAdapterProperties.num_eus_per_sub_slice); - printf("num_slices: %d\n", StDeviceAdapterProperties.num_slices); - printf("num_sub_slices_per_slice: %d\n", StDeviceAdapterProperties.num_sub_slices_per_slice); - printf("Graphics HW type: %s\n", StDeviceAdapterProperties.graphics_adapter_properties & CTL_ADAPTER_PROPERTIES_FLAG_INTEGRATED ? "Integrated" : "External GFX"); - - if ((INVALID_ADAPTER_BDF == StDeviceAdapterProperties.adapter_bdf.bus) && (INVALID_ADAPTER_BDF == StDeviceAdapterProperties.adapter_bdf.device) && - (INVALID_ADAPTER_BDF == StDeviceAdapterProperties.adapter_bdf.function)) + printf("GOP Version : %lld.%lld.%lld\n", pStDeviceAdapterProperties->firmware_version.major_version, pStDeviceAdapterProperties->firmware_version.minor_version, + pStDeviceAdapterProperties->firmware_version.build_number); + + printf("Intel Adapter Name: %s\n", pStDeviceAdapterProperties->name); + printf("Vendor ID: 0x%X\n", pStDeviceAdapterProperties->pci_vendor_id); + printf("Device ID: 0x%X\n", pStDeviceAdapterProperties->pci_device_id); + printf("SubSys id 0x%X\n", pStDeviceAdapterProperties->pci_subsys_id); + printf("SubSys Vendor id 0x%X\n", pStDeviceAdapterProperties->pci_subsys_vendor_id); + printf("Rev ID: 0x%X\n", pStDeviceAdapterProperties->rev_id); + printf("Graphics Frequency: %dMHz\n", pStDeviceAdapterProperties->Frequency); + printf("num_eus_per_sub_slice: %d\n", pStDeviceAdapterProperties->num_eus_per_sub_slice); + printf("num_slices: %d\n", pStDeviceAdapterProperties->num_slices); + printf("num_sub_slices_per_slice: %d\n", pStDeviceAdapterProperties->num_sub_slices_per_slice); + printf("Graphics HW type: %s\n", pStDeviceAdapterProperties->graphics_adapter_properties & CTL_ADAPTER_PROPERTIES_FLAG_INTEGRATED ? "Integrated" : "External GFX"); + + if ((INVALID_ADAPTER_BDF == pStDeviceAdapterProperties->adapter_bdf.bus) && (INVALID_ADAPTER_BDF == pStDeviceAdapterProperties->adapter_bdf.device) && + (INVALID_ADAPTER_BDF == pStDeviceAdapterProperties->adapter_bdf.function)) { printf("ctlGetDeviceProperties returned invalid adapter BDF.\n"); } else { - printf("adapter_bdf.bus:%d\n", StDeviceAdapterProperties.adapter_bdf.bus); - printf("adapter_bdf.device:%d\n", StDeviceAdapterProperties.adapter_bdf.device); - printf("adapter_bdf.function:%d\n", StDeviceAdapterProperties.adapter_bdf.function); + printf("adapter_bdf.bus:%d\n", pStDeviceAdapterProperties->adapter_bdf.bus); + printf("adapter_bdf.device:%d\n", pStDeviceAdapterProperties->adapter_bdf.device); + printf("adapter_bdf.function:%d\n", pStDeviceAdapterProperties->adapter_bdf.function); } } @@ -839,7 +844,7 @@ ctl_result_t CtlAdapterTesting(void) if (0x8086 != StDeviceAdapterProperties.pci_vendor_id) continue; - PrintAdapterProperties(StDeviceAdapterProperties); + PrintAdapterProperties(&StDeviceAdapterProperties); // get max/P0 from L0 & print the same here try diff --git a/Samples/Media_Samples/Media_Sample_App.cpp b/Samples/Media_Samples/Media_Sample_App.cpp index adb7e61..8d1cec4 100644 --- a/Samples/Media_Samples/Media_Sample_App.cpp +++ b/Samples/Media_Samples/Media_Sample_App.cpp @@ -1084,7 +1084,6 @@ int main() if (NULL != StDeviceAdapterProperties.pDeviceID) { free(StDeviceAdapterProperties.pDeviceID); - StDeviceAdapterProperties.pDeviceID = NULL; } } } diff --git a/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp b/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp index c0da951..bf7a216 100644 --- a/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp +++ b/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp @@ -565,6 +565,72 @@ ctl_result_t TestFbcPowerFeature(ctl_display_output_handle_t hDisplayOutput) return Result; } +/*************************************************************** + * @brief + * Power feature Test for CABC + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestCABCPowerFeature(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_power_optimization_settings_t NewPowerSettings = { 0 }; + ctl_power_optimization_settings_t AppliedPowerSettings = { 0 }; + ctl_power_optimization_caps_t PowerCaps = { 0 }; + + PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + AppliedPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + AppliedPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; + AppliedPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; + AppliedPowerSettings.PowerOptimizationPlan = CTL_POWER_OPTIMIZATION_PLAN_BALANCED; + + Result = ctlGetPowerOptimizationCaps(hDisplayOutput, &PowerCaps); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationCaps (CABC)"); + + Result = ctlGetPowerOptimizationSetting(hDisplayOutput, &AppliedPowerSettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationSetting (CABC)"); + + if ((CTL_POWER_OPTIMIZATION_FLAG_DPST != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_DPST)) || + (CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC != (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.SupportedFeatures & CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC))) + { + printf("CABC is not supported\n"); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + + printf("GetPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC\n"); + printf("CABC MinLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); + printf("CABC MaxLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); + + uint8_t Levels[2] = { AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel, AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel }; + NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + NewPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; + NewPowerSettings.Enable = TRUE; + NewPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC; + NewPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; + NewPowerSettings.PowerOptimizationPlan = CTL_POWER_OPTIMIZATION_PLAN_BALANCED; + + for (uint8_t Count = 0; Count < 2; Count++) + { + // Set PowerFeature + NewPowerSettings.FeatureSpecificData.DPSTInfo.Level = Levels[Count]; + + Result = ctlSetPowerOptimizationSetting(hDisplayOutput, &NewPowerSettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlSetPowerOptimizationSetting (CABC)"); + + Result = ctlGetPowerOptimizationSetting(hDisplayOutput, &AppliedPowerSettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationSetting (CABC)"); + + if (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level != NewPowerSettings.FeatureSpecificData.DPSTInfo.Level) + { + printf("Current and Applied levels mismatched: %d, %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); + } + } + +Exit: + return Result; +} + /*************************************************************** * @brief EnumerateDisplayHandles * Only for demonstration purpose, API is called for each of the display output handle in below snippet. @@ -635,6 +701,10 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput Result = TestFbcPowerFeature(hDisplayOutput[DisplayIndex]); STORE_AND_RESET_ERROR(Result); + + Result = TestCABCPowerFeature(hDisplayOutput[DisplayIndex]); + + STORE_AND_RESET_ERROR(Result); } Exit: diff --git a/Samples/Scaling_Samples/Scaling_App.cpp b/Samples/Scaling_Samples/Scaling_App.cpp index 969673f..196f43a 100644 --- a/Samples/Scaling_Samples/Scaling_App.cpp +++ b/Samples/Scaling_Samples/Scaling_App.cpp @@ -33,7 +33,7 @@ ctl_result_t GResult = CTL_RESULT_SUCCESS; * @param hDevices * @return ctl_result_t ***************************************************************/ -ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices) +ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices, uint8_t ScaleType, uint32_t PerX = 0, uint32_t PerY = 0) { ctl_display_output_handle_t *hDisplayOutput = NULL; uint32_t DisplayCount = 0; @@ -111,10 +111,34 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices) printf("ctlGetSupportedScalingCapability returned caps: 0x%X\n", ScalingCaps.SupportedScaling); + printf("\n******* Supported Scaling types ********\n"); + + if (CTL_SCALING_TYPE_FLAG_IDENTITY & ScalingCaps.SupportedScaling) + { + printf("CTL_SCALING_TYPE_FLAG_IDENTITY(1) is supported\n"); + } + if (CTL_SCALING_TYPE_FLAG_CENTERED & ScalingCaps.SupportedScaling) + { + printf("CTL_SCALING_TYPE_FLAG_CENTERED(2) is supported\n"); + } + if (CTL_SCALING_TYPE_FLAG_STRETCHED & ScalingCaps.SupportedScaling) + { + printf("CTL_SCALING_TYPE_FLAG_STRETCHED(4) is supported\n"); + } + if (CTL_SCALING_TYPE_FLAG_ASPECT_RATIO_CENTERED_MAX & ScalingCaps.SupportedScaling) + { + printf("CTL_SCALING_TYPE_FLAG_ASPECT_RATIO_CENTERED_MAX(8) is supported\n"); + } + if (CTL_SCALING_TYPE_FLAG_CUSTOM & ScalingCaps.SupportedScaling) + { + printf("CTL_SCALING_TYPE_FLAG_CUSTOM(16) is supported\n"); + } + if (0 != ScalingCaps.SupportedScaling) { - ScalingSetting.Size = sizeof(ctl_scaling_settings_t); - Result = ctlGetCurrentScaling(hDisplayOutput[i], &ScalingSetting); + ScalingSetting.Size = sizeof(ctl_scaling_settings_t); + ScalingSetting.Version = 1; + Result = ctlGetCurrentScaling(hDisplayOutput[i], &ScalingSetting); if (CTL_RESULT_SUCCESS != Result) { @@ -122,11 +146,11 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices) STORE_AND_RESET_ERROR(Result); continue; } - printf("ctlGetCurrentScaling returned Enable: 0x%X type:0x%x\n", ScalingSetting.Enable, ScalingSetting.ScalingType); + printf("ctlGetCurrentScaling returned Enable: 0x%X ScalingType:0x%x PreferredScalingType:0x%x\n", ScalingSetting.Enable, ScalingSetting.ScalingType, ScalingSetting.PreferredScalingType); } // fill custom scaling details only if it is supported - if (0x1F == ScalingCaps.SupportedScaling) + if ((CTL_SCALING_TYPE_FLAG_CUSTOM & ScalingCaps.SupportedScaling) && (CTL_SCALING_TYPE_FLAG_CUSTOM == ScaleType)) { // check if hardware modeset required to apply custom scaling ModeSet = ((TRUE == ScalingSetting.Enable) && (CTL_SCALING_TYPE_FLAG_CUSTOM == ScalingSetting.ScalingType)) ? FALSE : TRUE; @@ -136,9 +160,25 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices) ScalingSetting.ScalingType = CTL_SCALING_TYPE_FLAG_CUSTOM; ScalingSetting.Size = sizeof(ctl_scaling_settings_t); ScalingSetting.HardwareModeSet = (TRUE == ModeSet) ? TRUE : FALSE; - ScalingSetting.CustomScalingX = 1000; - ScalingSetting.CustomScalingY = 1000; + ScalingSetting.Version = 1; + + printf("*** PerX:%d PerY:%d ***\n", PerX, PerY); + + ScalingSetting.CustomScalingX = PerX; + ScalingSetting.CustomScalingY = PerY; + } + else + { + // filling custom scaling details + ScalingSetting = { 0 }; + ScalingSetting.Enable = true; + ScalingSetting.ScalingType = ScaleType; + ScalingSetting.Size = sizeof(ctl_scaling_settings_t); + ScalingSetting.Version = 1; } + + printf("ScalingSetting.ScalingType:%d\n", ScalingSetting.ScalingType); + Result = ctlSetCurrentScaling(hDisplayOutput[i], &ScalingSetting); if (CTL_RESULT_SUCCESS != Result) @@ -148,16 +188,24 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices) continue; } // check if the applied scaling was successful - ScalingSetting = { 0 }; - ScalingSetting.Size = sizeof(ctl_scaling_settings_t); - Result = ctlGetCurrentScaling(hDisplayOutput[i], &ScalingSetting); + ScalingSetting = { 0 }; + ScalingSetting.Size = sizeof(ctl_scaling_settings_t); + ScalingSetting.Version = 1; + Result = ctlGetCurrentScaling(hDisplayOutput[i], &ScalingSetting); if (CTL_RESULT_SUCCESS != Result) { printf("ctlGetCurrentScaling returned failure code: 0x%X\n", Result); STORE_AND_RESET_ERROR(Result); continue; } - printf("ctlGetCurrentScaling returned Enable: 0x%X type:0x%x\n", ScalingSetting.Enable, ScalingSetting.ScalingType); + + printf("ctlGetCurrentScaling returned Enable: 0x%X ScalingType:0x%x PreferredScalingType:0x%x\n", ScalingSetting.Enable, ScalingSetting.ScalingType, ScalingSetting.PreferredScalingType); + + if (CTL_SCALING_TYPE_FLAG_CUSTOM == ScalingSetting.ScalingType) + { + printf("ScalingSetting.CustomScalingX:%d\n", ScalingSetting.CustomScalingX); + printf("ScalingSetting.CustomScalingY:%d\n", ScalingSetting.CustomScalingY); + } } Exit: @@ -171,8 +219,31 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices) * @param * @return ***************************************************************/ -int main() +int main(int argc, char *pArgv[]) { + uint8_t ScaleType = 0; + uint32_t X = 0, Y = 0; + + if (argc < 2) + { + printf("Enter Scale type!\""); + return 0; + } + + // Converting string type to integer type + // using function "atoi( argument)" + + if (2 == argc) + { + ScaleType = atoi(pArgv[1]); + } + else if (4 == argc) + { + ScaleType = atoi(pArgv[1]); + X = atoi(pArgv[2]); + Y = atoi(pArgv[3]); + } + ctl_result_t Result = CTL_RESULT_SUCCESS; ctl_device_adapter_handle_t *hDevices = NULL; // Get a handle to the DLL module. @@ -231,7 +302,7 @@ int main() for (uint32_t i = 0; i < AdapterCount; i++) { - Result = ScalingTest(hDevices[i]); + Result = ScalingTest(hDevices[i], ScaleType, X, Y); if (CTL_RESULT_SUCCESS != Result) { diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index 6a3fa17..5b99142 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -376,10 +376,12 @@ void CtlFrequencyTest(ctl_device_adapter_handle_t hDAhandle) clocks = new double[numClocks]; res = ctlFrequencyGetAvailableClocks(pFrequencyHandle[i], &numClocks, clocks); - - for (uint32_t i = 0; i < numClocks; i++) + if (CTL_RESULT_SUCCESS == res) { - PRINT_LOGS("\n[Frequency] Clock [%u] Freq[%f] MHz", i, clocks[i]); + for (uint32_t i = 0; i < numClocks; i++) + { + PRINT_LOGS("\n[Frequency] Clock [%u] Freq[%f] MHz", i, clocks[i]); + } } delete[] clocks; @@ -626,6 +628,111 @@ void CtlFanTest(ctl_device_adapter_handle_t hDAhandle) Sleep(100); } + + ctl_fan_speed_table_t FanTable = {}; + FanTable.Size = sizeof(ctl_fan_speed_table_t); + FanTable.numPoints = 10; + FanTable.Version = 0; + + for (uint32_t index = 0; index < 10; index++) + { + FanTable.table[index] = { 0 }; + FanTable.table[index].Version = 0; + FanTable.table[index].Size = sizeof(ctl_fan_temp_speed_t); + FanTable.table[index].temperature = (index + 1) * 10; + FanTable.table[index].speed.Size = sizeof(ctl_fan_speed_t); + FanTable.table[index].speed.Version = 0; + FanTable.table[index].speed.units = CTL_FAN_SPEED_UNITS_PERCENT; + FanTable.table[index].speed.speed = index * 10; + } + + res = ctlFanSetSpeedTableMode(pFanHandle[i], &FanTable); + if (res != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\n %s from Fan Set Speed Table Mode.", DecodeRetCode(res).c_str()); + } + else + { + PRINT_LOGS("\n[Fan] Set Speed Table Mode Success"); + } + + PRINT_LOGS("\n[Fan] Fan get Config:"); + + FanConfig = {}; + FanConfig.Size = sizeof(ctl_fan_config_t); + res = ctlFanGetConfig(pFanHandle[i], &FanConfig); + + if (res != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\n %s from Fan get Config.", DecodeRetCode(res).c_str()); + } + else + { + PRINT_LOGS("\n[Fan] Fan Config Mode [%u]", FanConfig.mode); + if (CTL_FAN_SPEED_MODE_DEFAULT == FanConfig.mode) + { + PRINT_LOGS("\n[Fan] Fan Config Mode: Default/Stock"); + } + else if (CTL_FAN_SPEED_MODE_FIXED == FanConfig.mode) + { + PRINT_LOGS("\n[Fan] Fan Config Fixed Speed [%u]", FanConfig.speedFixed.speed); + PRINT_LOGS("\n[Fan] Fan Config Fixed Speed Unit [%u]", FanConfig.speedFixed.units); + } + else if (CTL_FAN_SPEED_MODE_TABLE == FanConfig.mode) + { + PRINT_LOGS("\n[Fan] Fan Config Fan Table NumPoints [%u]", FanConfig.speedTable.numPoints); + for (int32_t numPoints = 0; numPoints < FanConfig.speedTable.numPoints; numPoints++) + { + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed Unit [%u]", FanConfig.speedTable.table[numPoints].speed.units); + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed [%u]", FanConfig.speedTable.table[numPoints].speed.speed); + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Temperature [%u]", FanConfig.speedTable.table[numPoints].temperature); + } + } + } + + res = ctlFanSetDefaultMode(pFanHandle[i]); + if (res != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\n %s from Fan Set DEFAULT Speed Table Mode.", DecodeRetCode(res).c_str()); + } + else + { + PRINT_LOGS("\n[Fan] Set DEFAULT Speed Table Mode Success"); + } + + PRINT_LOGS("\n[Fan] Fan get Config:"); + + FanConfig = {}; + FanConfig.Size = sizeof(ctl_fan_config_t); + res = ctlFanGetConfig(pFanHandle[i], &FanConfig); + + if (res != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\n %s from Fan get Config.", DecodeRetCode(res).c_str()); + } + else + { + PRINT_LOGS("\n[Fan] Fan Config Mode [%u]", FanConfig.mode); + if (CTL_FAN_SPEED_MODE_DEFAULT == FanConfig.mode) + { + PRINT_LOGS("\n[Fan] Fan Config Mode: Default/Stock"); + } + else if (CTL_FAN_SPEED_MODE_FIXED == FanConfig.mode) + { + PRINT_LOGS("\n[Fan] Fan Config Fixed Speed [%u]", FanConfig.speedFixed.speed); + PRINT_LOGS("\n[Fan] Fan Config Fixed Speed Unit [%u]", FanConfig.speedFixed.units); + } + else if (CTL_FAN_SPEED_MODE_TABLE == FanConfig.mode) + { + PRINT_LOGS("\n[Fan] Fan Config Fan Table NumPoints [%u]", FanConfig.speedTable.numPoints); + for (int32_t numPoints = 0; numPoints < FanConfig.speedTable.numPoints; numPoints++) + { + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed Unit [%u]", FanConfig.speedTable.table[numPoints].speed.units); + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed [%u]", FanConfig.speedTable.table[numPoints].speed.speed); + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Temperature [%u]", FanConfig.speedTable.table[numPoints].temperature); + } + } + } } cleanUp: @@ -1459,11 +1566,18 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentTemperature.type)); PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramCurrentTemperature.value.datadouble); - PRINT_LOGS("\nFan Speed:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.fanSpeed[0].bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.fanSpeed[0].units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.fanSpeed[0].type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.fanSpeed[0].value.datadouble); + PRINT_LOGS("\nFan Speeds:"); + for (uint32_t i = 0; i < CTL_FAN_COUNT; i++) + { + if (pPowerTelemetry.fanSpeed[i].bSupported) + { + PRINT_LOGS("\nFan %d:", i); + PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.fanSpeed[i].bSupported) ? "true" : "false")); + PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.fanSpeed[i].units)); + PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.fanSpeed[i].type)); + PRINT_LOGS("\nValue: %f", pPowerTelemetry.fanSpeed[i].value.datadouble); + } + } } else { diff --git a/Samples/inc/GenericIGCLApp.h b/Samples/inc/GenericIGCLApp.h index 121e90b..d286be2 100644 --- a/Samples/inc/GenericIGCLApp.h +++ b/Samples/inc/GenericIGCLApp.h @@ -406,8 +406,8 @@ inline void Print3DFeatureDetail(ctl_3d_feature_details_t *pFeatureDetails) printf(" pEGCaps->EGControlCaps.DefaultType = %d\n", pEGCaps->EGControlCaps.DefaultType); printf(" pEGCaps->EGModeCaps.DefaultType = %d\n", pEGCaps->EGModeCaps.DefaultType); - Print3DFeatureSupportedSettings(pEGCaps->EGControlCaps.SupportedTypes, EGControls, ENDURANCE_GAMING_CONTROLS); - Print3DFeatureSupportedSettings(pEGCaps->EGModeCaps.SupportedTypes, EGModes, ENDURANCE_GAMING_MODES); + Print3DFeatureSupportedSettings(pEGCaps->EGControlCaps.SupportedTypes, move(EGControls), ENDURANCE_GAMING_CONTROLS); + Print3DFeatureSupportedSettings(pEGCaps->EGModeCaps.SupportedTypes, move(EGModes), ENDURANCE_GAMING_MODES); } break; diff --git a/Source/cApiWrapper.cpp b/Source/cApiWrapper.cpp index 9acdd38..c881441 100644 --- a/Source/cApiWrapper.cpp +++ b/Source/cApiWrapper.cpp @@ -19,6 +19,7 @@ #include #include +#include //#define CTL_APIEXPORT @@ -106,18 +107,27 @@ ctlInit( // special code - only for ctlInit() if (NULL == hinstLib) { - wchar_t strDLLPath[CTL_DLL_PATH_LEN]; - result = GetControlAPIDLLPath(pInitDesc, strDLLPath); + std::vector strDLLPath; + try + { + strDLLPath.resize(CTL_DLL_PATH_LEN); + } + catch (std::bad_alloc&) + { + return CTL_RESULT_ERROR_OUT_OF_DEVICE_MEMORY; + } + + result = GetControlAPIDLLPath(pInitDesc, strDLLPath.data()); if (result == CTL_RESULT_SUCCESS) { #ifdef WINDOWS_UWP - hinstLib = LoadPackagedLibrary(strDLLPath, 0); + hinstLib = LoadPackagedLibrary(strDLLPath.data(), 0); #else DWORD dwFlags = LOAD_LIBRARY_SEARCH_SYSTEM32; #ifdef _DEBUG dwFlags = dwFlags | LOAD_LIBRARY_SEARCH_APPLICATION_DIR; #endif - hinstLib = LoadLibraryExW(strDLLPath, NULL, dwFlags); + hinstLib = LoadLibraryExW(strDLLPath.data(), NULL, dwFlags); #endif if (NULL == hinstLib) { diff --git a/Source/igcl_api.h b/Source/igcl_api.h new file mode 100644 index 0000000..e931d1a --- /dev/null +++ b/Source/igcl_api.h @@ -0,0 +1,7906 @@ +//=========================================================================== +// Copyright (C) 2022-23 Intel Corporation +// This software and the related documents are Intel copyrighted materials, and +// your use of them is governed by the express license under which they were +// provided to you ("License"). Unless the License provides otherwise, you may +// not use, modify, copy, publish, distribute, disclose or transmit this software +// or the related documents without Intel's prior written permission. This software +// and the related documents are provided as is, with no express or implied +// warranties, other than those that are expressly stated in the License. +//-------------------------------------------------------------------------- + +/** + * + * @file ctl_api.h + * @version v1-r1 + * + */ +#ifndef _CTL_API_H +#define _CTL_API_H +#if defined(__cplusplus) +#pragma once +#endif + +// standard headers +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +// Intel 'ctlApi' common types +#if !defined(__GNUC__) +#pragma region common +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAKE_VERSION +/// @brief Generates generic ::'ctlApi' API versions +#define CTL_MAKE_VERSION( _major, _minor ) (( _major << 16 )|( _minor & 0x0000ffff)) +#endif // CTL_MAKE_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAJOR_VERSION +/// @brief Extracts ::'ctlApi' API major version +#define CTL_MAJOR_VERSION( _ver ) ( _ver >> 16 ) +#endif // CTL_MAJOR_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MINOR_VERSION +/// @brief Extracts ::'ctlApi' API minor version +#define CTL_MINOR_VERSION( _ver ) ( _ver & 0x0000ffff ) +#endif // CTL_MINOR_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_IMPL_MAJOR_VERSION +/// @brief ::'ctlApi' API major version of this implementation +#define CTL_IMPL_MAJOR_VERSION 1 +#endif // CTL_IMPL_MAJOR_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_IMPL_MINOR_VERSION +/// @brief ::'ctlApi' API minor version of this implementation +#define CTL_IMPL_MINOR_VERSION 1 +#endif // CTL_IMPL_MINOR_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_IMPL_VERSION +/// @brief ::'ctlApi' API version of this implementation +#define CTL_IMPL_VERSION CTL_MAKE_VERSION( CTL_IMPL_MAJOR_VERSION, CTL_IMPL_MINOR_VERSION ) +#endif // CTL_IMPL_VERSION + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_APICALL +#if defined(_WIN32) +/// @brief Calling convention for all API functions +#define CTL_APICALL __cdecl +#else +#define CTL_APICALL +#endif // defined(_WIN32) +#endif // CTL_APICALL + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_APIEXPORT +#if defined(_WIN32) +/// @brief Microsoft-specific dllexport storage-class attribute +#define CTL_APIEXPORT __declspec(dllexport) +#else +#define CTL_APIEXPORT +#endif // defined(_WIN32) +#endif // CTL_APIEXPORT + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_DLLEXPORT +#if defined(_WIN32) +/// @brief Microsoft-specific dllexport storage-class attribute +#define CTL_DLLEXPORT __declspec(dllexport) +#endif // defined(_WIN32) +#endif // CTL_DLLEXPORT + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_DLLEXPORT +#if __GNUC__ >= 4 +/// @brief GCC-specific dllexport storage-class attribute +#define CTL_DLLEXPORT __attribute__ ((visibility ("default"))) +#else +#define CTL_DLLEXPORT +#endif // __GNUC__ >= 4 +#endif // CTL_DLLEXPORT + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_BIT +/// @brief Generic macro for enumerator bit masks +#define CTL_BIT( _i ) ( 1 << _i ) +#endif // CTL_BIT + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported initialization flags +typedef uint32_t ctl_init_flags_t; +typedef enum _ctl_init_flag_t +{ + CTL_INIT_FLAG_USE_LEVEL_ZERO = CTL_BIT(0), ///< Use Level0 or not. This is usually required for telemetry, + ///< performance, frequency related APIs + CTL_INIT_FLAG_MAX = 0x80000000 + +} ctl_init_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Version information +typedef uint32_t ctl_version_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a control API instance +typedef struct _ctl_api_handle_t *ctl_api_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a device adapter instance +typedef struct _ctl_device_adapter_handle_t *ctl_device_adapter_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a device temperature sensor +typedef struct _ctl_temp_handle_t *ctl_temp_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle for a device frequency domain +typedef struct _ctl_freq_handle_t *ctl_freq_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a power device. +typedef struct _ctl_pwr_handle_t *ctl_pwr_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a device fan +typedef struct _ctl_fan_handle_t *ctl_fan_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a device memory module +typedef struct _ctl_mem_handle_t *ctl_mem_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a device engine group +typedef struct _ctl_engine_handle_t *ctl_engine_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Base for all properties types +typedef struct _ctl_base_interface_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + +} ctl_base_interface_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Value type +typedef enum _ctl_property_value_type_t +{ + CTL_PROPERTY_VALUE_TYPE_BOOL = 0, ///< Boolean + CTL_PROPERTY_VALUE_TYPE_FLOAT = 1, ///< Float + CTL_PROPERTY_VALUE_TYPE_INT32 = 2, ///< Int32 + CTL_PROPERTY_VALUE_TYPE_UINT32 = 3, ///< Unsigned Int32 + CTL_PROPERTY_VALUE_TYPE_ENUM = 4, ///< Enum + CTL_PROPERTY_VALUE_TYPE_CUSTOM = 5, ///< Custom argument + CTL_PROPERTY_VALUE_TYPE_MAX + +} ctl_property_value_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Property range details, a generic struct to hold min/max/step size +/// information of various feature properties +typedef struct _ctl_property_range_info_t +{ + float min_possible_value; ///< [out] Minimum possible value + float max_possible_value; ///< [out] Maximum possible value + float step_size; ///< [out] Step size possible + float default_value; ///< [out] Default value + +} ctl_property_range_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Property range details of integer type, a generic struct to hold +/// min/max/step size information of various feature properties +typedef struct _ctl_property_range_info_int_t +{ + int32_t min_possible_value; ///< [out] Minimum possible value + int32_t max_possible_value; ///< [out] Maximum possible value + int32_t step_size; ///< [out] Step size possible + int32_t default_value; ///< [out] Default value + +} ctl_property_range_info_int_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Property range details of unsigned integer type, a generic struct to +/// hold min/max/step size information of various feature properties +typedef struct _ctl_property_range_info_uint_t +{ + uint32_t min_possible_value; ///< [out] Minimum possible value + uint32_t max_possible_value; ///< [out] Maximum possible value + uint32_t step_size; ///< [out] Step size possible + uint32_t default_value; ///< [out] Default value + +} ctl_property_range_info_uint_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Bool feature details +typedef struct _ctl_property_info_boolean_t +{ + bool DefaultState; ///< [out] Default state + +} ctl_property_info_boolean_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Bool feature for get/set +typedef struct _ctl_property_boolean_t +{ + bool Enable; ///< [in,out] Enable + +} ctl_property_boolean_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enumeration feature details +typedef struct _ctl_property_info_enum_t +{ + uint64_t SupportedTypes; ///< [out] Supported possible values represented as a bitmask + uint32_t DefaultType; ///< [out] Default type + +} ctl_property_info_enum_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enumeration feature for get/set +typedef struct _ctl_property_enum_t +{ + uint32_t EnableType; ///< [in,out] Enable with specific type + +} ctl_property_enum_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Float feature details +typedef struct _ctl_property_info_float_t +{ + bool DefaultEnable; ///< [in,out] DefaultEnable + ctl_property_range_info_t RangeInfo; ///< [out] Min/max/default/step details + +} ctl_property_info_float_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Float feature for get/set +typedef struct _ctl_property_float_t +{ + bool Enable; ///< [in,out] Enable + float Value; ///< [in,out] Value + +} ctl_property_float_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Int32 feature details +typedef struct _ctl_property_info_int_t +{ + bool DefaultEnable; ///< [in,out] DefaultEnable + ctl_property_range_info_int_t RangeInfo; ///< [out] Min/max/default/step details + +} ctl_property_info_int_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Int32 feature for get/set +typedef struct _ctl_property_int_t +{ + bool Enable; ///< [in,out] Enable + int32_t Value; ///< [in,out] Value + +} ctl_property_int_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Int32 feature details +typedef struct _ctl_property_info_uint_t +{ + bool DefaultEnable; ///< [in,out] DefaultEnable + ctl_property_range_info_uint_t RangeInfo; ///< [out] Min/max/default/step details + +} ctl_property_info_uint_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Int32 feature for get/set +typedef struct _ctl_property_uint_t +{ + bool Enable; ///< [in,out] Enable + uint32_t Value; ///< [in,out] Value + +} ctl_property_uint_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Feature element details, union of bool/float/enum property_info +/// structs. Used for feature specific capability check +typedef union _ctl_property_info_t +{ + ctl_property_info_boolean_t BoolType; ///< [in,out] Boolean type fields + ctl_property_info_float_t FloatType; ///< [in,out] Float type fields + ctl_property_info_int_t IntType; ///< [in,out] Int type fields + ctl_property_info_enum_t EnumType; ///< [in,out] Enum type fields + ctl_property_info_uint_t UIntType; ///< [in,out] Unsigned Int type fields + +} ctl_property_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Feature element details, union of bool/float/enum property structs. +/// Used for get/set calls +typedef union _ctl_property_t +{ + ctl_property_boolean_t BoolType; ///< [in,out] Boolean type fields + ctl_property_float_t FloatType; ///< [in,out] Float type fields + ctl_property_int_t IntType; ///< [in,out] Int type fields + ctl_property_enum_t EnumType; ///< [in,out] Enum type fields + ctl_property_uint_t UIntType; ///< [in,out] Unsigned Int type fields + +} ctl_property_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Defines Return/Error codes. +/// All generic error (bit30) codes are between 0x40000000-0x4000FFFF. +/// All 3D (bit 29) specific error codes are between 0x60000000-0x6000FFFF. +/// All media (bit 28) specific error codes are between 0x50000000-0x5000FFFF. +/// All display (bit 27) specific error codes are between 0x48000000-0x4800FFFF +/// All core (bit 26) specific error codes are between 0x44000000-0x4400FFFF +/// Success result code with additional info are between 0x00000001-0x0000FFFF. +typedef enum _ctl_result_t +{ + CTL_RESULT_SUCCESS = 0x00000000, ///< success + CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER = 0x00000001, ///< success but still open by another caller + CTL_RESULT_ERROR_SUCCESS_END = 0x0000FFFF, ///< "Success group error code end value, not to be used + ///< " + CTL_RESULT_ERROR_GENERIC_START = 0x40000000, ///< Generic error code starting value, not to be used + CTL_RESULT_ERROR_NOT_INITIALIZED = 0x40000001, ///< Result not initialized + CTL_RESULT_ERROR_ALREADY_INITIALIZED = 0x40000002, ///< Already initialized + CTL_RESULT_ERROR_DEVICE_LOST = 0x40000003, ///< Device hung, reset, was removed, or driver update occurred + CTL_RESULT_ERROR_OUT_OF_HOST_MEMORY = 0x40000004, ///< Insufficient host memory to satisfy call + CTL_RESULT_ERROR_OUT_OF_DEVICE_MEMORY = 0x40000005, ///< Insufficient device memory to satisfy call + CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS = 0x40000006, ///< Access denied due to permission level + CTL_RESULT_ERROR_NOT_AVAILABLE = 0x40000007, ///< Resource was removed + CTL_RESULT_ERROR_UNINITIALIZED = 0x40000008, ///< Library not initialized + CTL_RESULT_ERROR_UNSUPPORTED_VERSION = 0x40000009, ///< Generic error code for unsupported versions + CTL_RESULT_ERROR_UNSUPPORTED_FEATURE = 0x4000000a, ///< Generic error code for unsupported features + CTL_RESULT_ERROR_INVALID_ARGUMENT = 0x4000000b, ///< Generic error code for invalid arguments + CTL_RESULT_ERROR_INVALID_API_HANDLE = 0x4000000c, ///< API handle in invalid + CTL_RESULT_ERROR_INVALID_NULL_HANDLE = 0x4000000d, ///< Handle argument is not valid + CTL_RESULT_ERROR_INVALID_NULL_POINTER = 0x4000000e, ///< Pointer argument may not be nullptr + CTL_RESULT_ERROR_INVALID_SIZE = 0x4000000f, ///< Size argument is invalid (e.g., must not be zero) + CTL_RESULT_ERROR_UNSUPPORTED_SIZE = 0x40000010, ///< Size argument is not supported by the device (e.g., too large) + CTL_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 0x40000011, ///< Image format is not supported by the device + CTL_RESULT_ERROR_DATA_READ = 0x40000012, ///< Data read error + CTL_RESULT_ERROR_DATA_WRITE = 0x40000013, ///< Data write error + CTL_RESULT_ERROR_DATA_NOT_FOUND = 0x40000014, ///< Data not found error + CTL_RESULT_ERROR_NOT_IMPLEMENTED = 0x40000015, ///< Function not implemented + CTL_RESULT_ERROR_OS_CALL = 0x40000016, ///< Operating system call failure + CTL_RESULT_ERROR_KMD_CALL = 0x40000017, ///< Kernel mode driver call failure + CTL_RESULT_ERROR_UNLOAD = 0x40000018, ///< Library unload failure + CTL_RESULT_ERROR_ZE_LOADER = 0x40000019, ///< Level0 loader not found + CTL_RESULT_ERROR_INVALID_OPERATION_TYPE = 0x4000001a, ///< Invalid operation type + CTL_RESULT_ERROR_NULL_OS_INTERFACE = 0x4000001b,///< Null OS interface + CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE = 0x4000001c, ///< Null OS adapter handle + CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE = 0x4000001d,///< Null display output handle + CTL_RESULT_ERROR_WAIT_TIMEOUT = 0x4000001e, ///< Timeout in Wait function + CTL_RESULT_ERROR_PERSISTANCE_NOT_SUPPORTED = 0x4000001f,///< Persistance not supported + CTL_RESULT_ERROR_PLATFORM_NOT_SUPPORTED = 0x40000020, ///< Platform not supported + CTL_RESULT_ERROR_UNKNOWN_APPLICATION_UID = 0x40000021, ///< Unknown Appplicaion UID in Initialization call + CTL_RESULT_ERROR_INVALID_ENUMERATION = 0x40000022, ///< The enum is not valid + CTL_RESULT_ERROR_FILE_DELETE = 0x40000023, ///< Error in file delete operation + CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED = 0x40000024,///< The device requires a reset. + CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED = 0x40000025, ///< The device requires a full reboot. + CTL_RESULT_ERROR_LOAD = 0x40000026, ///< Library load failure + CTL_RESULT_ERROR_UNKNOWN = 0x4000FFFF, ///< Unknown or internal error + CTL_RESULT_ERROR_RETRY_OPERATION = 0x40010000, ///< Operation failed, retry previous operation again + CTL_RESULT_ERROR_GENERIC_END = 0x4000FFFF, ///< "Generic error code end value, not to be used + ///< " + CTL_RESULT_ERROR_CORE_START = 0x44000000, ///< Core error code starting value, not to be used + CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED = 0x44000001, ///< The Overclock is not supported. + CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE = 0x44000002, ///< The Voltage exceeds the acceptable min/max. + CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE = 0x44000003, ///< The Frequency exceeds the acceptable min/max. + CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE = 0x44000004, ///< The Power exceeds the acceptable min/max. + CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE = 0x44000005, ///< The Power exceeds the acceptable min/max. + CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE = 0x44000006,///< The Overclock is in voltage locked mode. + CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED = 0x44000007,///< It indicates that the requested change will not be applied until the + ///< device is reset. + CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET = 0x44000008,///< The $OverclockWaiverSet function has not been called. + CTL_RESULT_ERROR_CORE_END = 0x0440FFFF, ///< "Core error code end value, not to be used + ///< " + CTL_RESULT_ERROR_3D_START = 0x60000000, ///< 3D error code starting value, not to be used + CTL_RESULT_ERROR_3D_END = 0x6000FFFF, ///< "3D error code end value, not to be used + ///< " + CTL_RESULT_ERROR_MEDIA_START = 0x50000000, ///< Media error code starting value, not to be used + CTL_RESULT_ERROR_MEDIA_END = 0x5000FFFF, ///< "Media error code end value, not to be used + ///< " + CTL_RESULT_ERROR_DISPLAY_START = 0x48000000, ///< Display error code starting value, not to be used + CTL_RESULT_ERROR_INVALID_AUX_ACCESS_FLAG = 0x48000001, ///< Invalid flag for Aux access + CTL_RESULT_ERROR_INVALID_SHARPNESS_FILTER_FLAG = 0x48000002,///< Invalid flag for Sharpness + CTL_RESULT_ERROR_DISPLAY_NOT_ATTACHED = 0x48000003, ///< Error for Display not attached + CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE = 0x48000004, ///< Error for display attached but not active + CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG = 0x48000005, ///< Error for invalid power optimization flag + CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST = 0x48000006,///< DPST is supported only in DC Mode + CTL_RESULT_ERROR_INVALID_PIXTX_GET_CONFIG_QUERY_TYPE = 0x48000007, ///< Invalid query type for pixel transformation get configuration + CTL_RESULT_ERROR_INVALID_PIXTX_SET_CONFIG_OPERATION_TYPE = 0x48000008, ///< Invalid operation type for pixel transformation set configuration + CTL_RESULT_ERROR_INVALID_SET_CONFIG_NUMBER_OF_SAMPLES = 0x48000009, ///< Invalid number of samples for pixel transformation set configuration + CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID = 0x4800000a, ///< Invalid block id for pixel transformation + CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_TYPE = 0x4800000b, ///< Invalid block type for pixel transformation + CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_NUMBER = 0x4800000c, ///< Invalid block number for pixel transformation + CTL_RESULT_ERROR_INSUFFICIENT_PIXTX_BLOCK_CONFIG_MEMORY = 0x4800000d, ///< Insufficient memery allocated for BlockConfigs + CTL_RESULT_ERROR_3DLUT_INVALID_PIPE = 0x4800000e, ///< Invalid pipe for 3dlut + CTL_RESULT_ERROR_3DLUT_INVALID_DATA = 0x4800000f, ///< Invalid 3dlut data + CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR = 0x48000010, ///< 3dlut not supported in HDR + CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION = 0x48000011, ///< Invalid 3dlut operation + CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL = 0x48000012, ///< 3dlut call unsuccessful + CTL_RESULT_ERROR_AUX_DEFER = 0x48000013, ///< AUX defer failure + CTL_RESULT_ERROR_AUX_TIMEOUT = 0x48000014, ///< AUX timeout failure + CTL_RESULT_ERROR_AUX_INCOMPLETE_WRITE = 0x48000015, ///< AUX incomplete write failure + CTL_RESULT_ERROR_I2C_AUX_STATUS_UNKNOWN = 0x48000016, ///< I2C/AUX unkonown failure + CTL_RESULT_ERROR_I2C_AUX_UNSUCCESSFUL = 0x48000017, ///< I2C/AUX unsuccessful + CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED = 0x48000018,///< Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data + ///< passed by user + CTL_RESULT_ERROR_EXTERNAL_DISPLAY_ATTACHED = 0x48000019,///< External Display is Attached hence fail the Display Switch + CTL_RESULT_ERROR_CUSTOM_MODE_STANDARD_CUSTOM_MODE_EXISTS = 0x4800001a, ///< Standard custom mode exists + CTL_RESULT_ERROR_CUSTOM_MODE_NON_CUSTOM_MATCHING_MODE_EXISTS = 0x4800001b, ///< Non custom matching mode exists + CTL_RESULT_ERROR_CUSTOM_MODE_INSUFFICIENT_MEMORY = 0x4800001c, ///< Custom mode insufficent memory + CTL_RESULT_ERROR_ADAPTER_ALREADY_LINKED = 0x4800001d, ///< Adapter is already linked + CTL_RESULT_ERROR_ADAPTER_NOT_IDENTICAL = 0x4800001e,///< Adapter is not identical for linking + CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY = 0x4800001f, ///< Adapter is LDA Secondary, so not supporting requested operation + CTL_RESULT_ERROR_SET_FBC_FEATURE_NOT_SUPPORTED = 0x48000020,///< Set FBC Feature not supported + CTL_RESULT_ERROR_DISPLAY_END = 0x4800FFFF, ///< "Display error code end value, not to be used + ///< " + CTL_RESULT_MAX + +} ctl_result_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAX_DEVICE_NAME_LEN +/// @brief Maximum IPC handle size +#define CTL_MAX_DEVICE_NAME_LEN 100 +#endif // CTL_MAX_DEVICE_NAME_LEN + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAX_RESERVED_SIZE +/// @brief Maximum reserved size for future members. +#define CTL_MAX_RESERVED_SIZE 112 +#endif // CTL_MAX_RESERVED_SIZE + +/////////////////////////////////////////////////////////////////////////////// +/// @brief General Physical Units. +typedef enum _ctl_units_t +{ + CTL_UNITS_FREQUENCY_MHZ = 0, ///< Type is Frequency with units in MHz. + CTL_UNITS_OPERATIONS_GTS = 1, ///< Type is Frequency with units in GT/s (gigatransfers per second). + CTL_UNITS_OPERATIONS_MTS = 2, ///< Type is Frequency with units in MT/s (megatransfers per second). + CTL_UNITS_VOLTAGE_VOLTS = 3, ///< Type is Voltage with units in Volts. + CTL_UNITS_POWER_WATTS = 4, ///< Type is Power with units in Watts. + CTL_UNITS_TEMPERATURE_CELSIUS = 5, ///< Type is Temperature with units in Celsius. + CTL_UNITS_ENERGY_JOULES = 6, ///< Type is Energy with units in Joules. + CTL_UNITS_TIME_SECONDS = 7, ///< Type is Time with units in Seconds. + CTL_UNITS_MEMORY_BYTES = 8, ///< Type is Memory with units in Bytes. + CTL_UNITS_ANGULAR_SPEED_RPM = 9, ///< Type is Angular Speed with units in Revolutions per Minute. + CTL_UNITS_POWER_MILLIWATTS = 10, ///< Type is Power with units in MilliWatts. + CTL_UNITS_PERCENT = 11, ///< Type is Percentage. + CTL_UNITS_MEM_SPEED_GBPS = 12, ///< Type is Memory Speed in Gigabyte per Seconds (Gbps) + CTL_UNITS_VOLTAGE_MILLIVOLTS = 13, ///< Type is Voltage with units in milliVolts. + CTL_UNITS_UNKNOWN = 0x4800FFFF, ///< Type of units unknown. + CTL_UNITS_MAX + +} ctl_units_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief General Data Types. +typedef enum _ctl_data_type_t +{ + CTL_DATA_TYPE_INT8 = 0, ///< The data type is 8 bit signed integer. + CTL_DATA_TYPE_UINT8 = 1, ///< The data type is 8 bit unsigned integer. + CTL_DATA_TYPE_INT16 = 2, ///< The data type is 16 bit signed integer. + CTL_DATA_TYPE_UINT16 = 3, ///< The data type is 16 bit unsigned integer. + CTL_DATA_TYPE_INT32 = 4, ///< The data type is 32 bit signed integer. + CTL_DATA_TYPE_UINT32 = 5, ///< The data type is 32 bit unsigned integer. + CTL_DATA_TYPE_INT64 = 6, ///< The data type is 64 bit signed integer. + CTL_DATA_TYPE_UINT64 = 7, ///< The data type is 64 bit unsigned integer. + CTL_DATA_TYPE_FLOAT = 8, ///< The data type is 32 bit floating point. + CTL_DATA_TYPE_DOUBLE = 9, ///< The data type is 64 bit floating point. + CTL_DATA_TYPE_STRING_ASCII = 10, ///< The data type is an array of 8 bit unsigned integers. + CTL_DATA_TYPE_STRING_UTF16 = 11, ///< The data type is an array of 16 bit unsigned integers. + CTL_DATA_TYPE_STRING_UTF132 = 12, ///< The data type is an array of 32 bit unsigned integers. + CTL_DATA_TYPE_UNKNOWN = 0x4800FFFF, ///< The data type is unknown. + CTL_DATA_TYPE_MAX + +} ctl_data_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Union for Generic Data. +/// +/// @details +/// - The telemetry data items could be of different types. +/// - Refer to ::ctl_data_type_t to find the current type. +typedef union _ctl_data_value_t +{ + int8_t data8; ///< [out] The data type is 8 bit signed integer. + uint8_t datau8; ///< [out] The data type is 8 bit unsigned integer. + int16_t data16; ///< [out] The data type is 16 bit signed integer. + uint16_t datau16; ///< [out] The data type is 16 bit unsigned integer. + int32_t data32; ///< [out] The data type is 32 bit signed integer. + uint32_t datau32; ///< [out] The data type is 32 bit unsigned integer. + int64_t data64; ///< [out] The data type is 64 bit signed integer. + uint64_t datau64; ///< [out] The data type is 64 bit unsigned integer. + float datafloat; ///< [out] The data type is 32 bit floating point. + double datadouble; ///< [out] The data type is 64 bit floating point. + +} ctl_data_value_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Base for all properties types +typedef struct _ctl_base_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + +} ctl_base_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Application Unique ID +typedef struct _ctl_application_id_t +{ + uint32_t Data1; ///< [in] Data1 + uint16_t Data2; ///< [in] Data2 + uint16_t Data3; ///< [in] Data3 + uint8_t Data4[8]; ///< [in] Data4 + +} ctl_application_id_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Init arguments +typedef struct _ctl_init_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_version_info_t AppVersion; ///< [in][release] App's IGCL version + ctl_init_flags_t flags; ///< [in][release] Caller version + ctl_version_info_t SupportedVersion; ///< [out][release] IGCL implementation version + ctl_application_id_t ApplicationUID; ///< [in] Application Provided Unique ID.Application can pass all 0's as + ///< the default ID + +} ctl_init_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Reserved struct +typedef struct _ctl_reserved_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + void* pSpecialArg; ///< [in] Reserved struct + uint32_t ArgSize; ///< [in] struct size + +} ctl_reserved_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Reserved base struct +typedef struct _ctl_reserved_args_base_t +{ + ctl_application_id_t ReservedFuncID; ///< [in] Unique ID for reserved/special function + +} ctl_reserved_args_base_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Reserved - Unlock function capability +typedef struct _ctl_unlock_capability_t +{ + ctl_application_id_t ReservedFuncID; ///< [in] Unique ID for reserved/special function + ctl_application_id_t UnlockCapsID; ///< [in] Unique ID to unlock a specific function + +} ctl_unlock_capability_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Used by loader like modules to specify runtime implementation details +typedef struct _ctl_runtime_path_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_application_id_t UnlockID; ///< [in] Unique ID for reserved/special function + wchar_t* pRuntimePath; ///< [in] Path to runtime DLL + uint16_t DeviceID; ///< [in] Device ID of interest to caller. pRuntimePath should not be NULL. + uint8_t RevID; ///< [in] Revision ID of interest to caller. pRuntimePath should not be + ///< NULL. + +} ctl_runtime_path_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Control Api Init +/// +/// @details +/// - Control Api Init +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pInitDesc` +/// + `nullptr == phAPIHandle` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlInit( + ctl_init_args_t* pInitDesc, ///< [in][out] App's control API version + ctl_api_handle_t* phAPIHandle ///< [in][out][release] Control API handle + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Control Api Destroy +/// +/// @details +/// - Control Api Close +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hAPIHandle` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlClose( + ctl_api_handle_t hAPIHandle ///< [in][release] Control API implementation handle obtained during init + ///< call + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Runtime path +/// +/// @details +/// - Control Api set runtime path. Optional call from a loader which allows +/// the loaded runtime to enumerate only the adapters which the specified +/// runtime is responsible for. This is done usually by a loader or by +/// callers who know how to get the specific runtime of interest. This +/// call right now is reserved for use by Intel components. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlSetRuntimePath( + ctl_runtime_path_args_t* pArgs ///< [in] Runtime path + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported Functions +typedef uint32_t ctl_supported_functions_flags_t; +typedef enum _ctl_supported_functions_flag_t +{ + CTL_SUPPORTED_FUNCTIONS_FLAG_DISPLAY = CTL_BIT(0), ///< [out] Is Display supported + CTL_SUPPORTED_FUNCTIONS_FLAG_3D = CTL_BIT(1), ///< [out] Is 3D supported + CTL_SUPPORTED_FUNCTIONS_FLAG_MEDIA = CTL_BIT(2),///< [out] Is Media supported + CTL_SUPPORTED_FUNCTIONS_FLAG_MAX = 0x80000000 + +} ctl_supported_functions_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Firmware version +typedef struct _ctl_firmware_version_t +{ + uint64_t major_version; ///< [out] Major version + uint64_t minor_version; ///< [out] Minor version + uint64_t build_number; ///< [out] Build number + +} ctl_firmware_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief DeviceType +typedef enum _ctl_device_type_t +{ + CTL_DEVICE_TYPE_GRAPHICS = 1, ///< Graphics Device type + CTL_DEVICE_TYPE_SYSTEM = 2, ///< System Device type + CTL_DEVICE_TYPE_MAX + +} ctl_device_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Adapter Properties +typedef uint32_t ctl_adapter_properties_flags_t; +typedef enum _ctl_adapter_properties_flag_t +{ + CTL_ADAPTER_PROPERTIES_FLAG_INTEGRATED = CTL_BIT(0),///< [out] Is Integrated Graphics adapter + CTL_ADAPTER_PROPERTIES_FLAG_LDA_PRIMARY = CTL_BIT(1), ///< [out] Is Primary (Lead) adapter in a Linked Display Adapter (LDA) + ///< chain + CTL_ADAPTER_PROPERTIES_FLAG_LDA_SECONDARY = CTL_BIT(2), ///< [out] Is Secondary (Linked) adapter in a Linked Display Adapter (LDA) + ///< chain + CTL_ADAPTER_PROPERTIES_FLAG_MAX = 0x80000000 + +} ctl_adapter_properties_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Adapter Pci Bus, Device, Function +typedef struct _ctl_adapter_bdf_t +{ + uint8_t bus; ///< [out] PCI Bus Number + uint8_t device; ///< [out] PCI device number + uint8_t function; ///< [out] PCI function + +} ctl_adapter_bdf_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Device Adapter properties +typedef struct _ctl_device_adapter_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + void* pDeviceID; ///< [in,out] OS specific Device ID + uint32_t device_id_size; ///< [in] size of the device ID + ctl_device_type_t device_type; ///< [out] Device Type + ctl_supported_functions_flags_t supported_subfunction_flags;///< [out] Supported functions + uint64_t driver_version; ///< [out] Driver version + ctl_firmware_version_t firmware_version; ///< [out] Firmware version + uint32_t pci_vendor_id; ///< [out] PCI Vendor ID + uint32_t pci_device_id; ///< [out] PCI Device ID + uint32_t rev_id; ///< [out] PCI Revision ID + uint32_t num_eus_per_sub_slice; ///< [out] Number of EUs per sub-slice + uint32_t num_sub_slices_per_slice; ///< [out] Number of sub-slices per slice + uint32_t num_slices; ///< [out] Number of slices + char name[CTL_MAX_DEVICE_NAME_LEN]; ///< [out] Device name + ctl_adapter_properties_flags_t graphics_adapter_properties; ///< [out] Graphics Adapter Properties + uint32_t Frequency; ///< [out] Clock frequency for this device. Supported only for Version > 0 + uint16_t pci_subsys_id; ///< [out] PCI SubSys ID, Supported only for Version > 1 + uint16_t pci_subsys_vendor_id; ///< [out] PCI SubSys Vendor ID, Supported only for Version > 1 + ctl_adapter_bdf_t adapter_bdf; ///< [out] Pci Bus, Device, Function. Supported only for Version > 1 + char reserved[CTL_MAX_RESERVED_SIZE]; ///< [out] Reserved + +} ctl_device_adapter_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief OperationType +typedef enum _ctl_operation_type_t +{ + CTL_OPERATION_TYPE_READ = 1, ///< Read operation + CTL_OPERATION_TYPE_WRITE = 2, ///< Write operation + CTL_OPERATION_TYPE_MAX + +} ctl_operation_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Generic Structure for Void* datatypes +typedef struct _ctl_generic_void_datatype_t +{ + void* pData; ///< [in,out]void pointer to memory + uint32_t size; ///< [in,out]size of the allocated memory + +} ctl_generic_void_datatype_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Generic Structure for Revision datatypes +typedef struct _ctl_revision_datatype_t +{ + uint8_t major_version; ///< [in,out]Major Version + uint8_t minor_version; ///< [in,out]Minor Version + uint8_t revision_version; ///< [in,out]Revision Version + +} ctl_revision_datatype_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Property Type flags +typedef uint32_t ctl_property_type_flags_t; +typedef enum _ctl_property_type_flag_t +{ + CTL_PROPERTY_TYPE_FLAG_DISPLAY = CTL_BIT(0), ///< Display type. Supported scenarios: Sharpness/gamma/CSC + CTL_PROPERTY_TYPE_FLAG_3D = CTL_BIT(1), ///< 3D type. Supported scenarios: All set calls via IGCL's 3D APIs + CTL_PROPERTY_TYPE_FLAG_MEDIA = CTL_BIT(2), ///< Media type. Supported scenarios: All set calls via IGCL's media APIs + CTL_PROPERTY_TYPE_FLAG_CORE = CTL_BIT(3), ///< For future: Core graphic event types like clocking, frequency etc. + CTL_PROPERTY_TYPE_FLAG_MAX = 0x80000000 + +} ctl_property_type_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Arguments related to wait for a property change function +typedef struct _ctl_wait_property_change_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_property_type_flags_t PropertyType; ///< [in] Type of the property + uint32_t TimeOutMilliSec; ///< [in][release] Time-out interval in milliseconds. Specify 0xFFFFFFFF if + ///< time-out is not desired + uint32_t EventMiscFlags; ///< [in][release] Event flags for future use + void* pReserved; ///< [in][release] Reserved for future use + uint64_t ReservedOutFlags; ///< [out] Reserved out argument for future use + +} ctl_wait_property_change_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Display orientation (rotation) +typedef enum _ctl_display_orientation_t +{ + CTL_DISPLAY_ORIENTATION_0 = 0, ///< 0 Degree + CTL_DISPLAY_ORIENTATION_90 = 1, ///< 90 Degree + CTL_DISPLAY_ORIENTATION_180 = 2, ///< 180 Degree + CTL_DISPLAY_ORIENTATION_270 = 3, ///< 270 Degree + CTL_DISPLAY_ORIENTATION_MAX + +} ctl_display_orientation_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Rectangle +typedef struct _ctl_rect_t +{ + int32_t Left; ///< [in,out] Left + int32_t Top; ///< [in,out] Top + int32_t Right; ///< [in,out] Right + int32_t Bottom; ///< [in,out] Bottom + +} ctl_rect_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Wait for a property change. Note that this is a blocking call +/// +/// @details +/// - Wait for a property change in display, 3d, media etc. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlWaitForPropertyChange( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + ctl_wait_property_change_args_t* pArgs ///< [in] Argument containing information about which property changes to + ///< listen for + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Reserved function +/// +/// @details +/// - Reserved function +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlReservedCall( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + ctl_reserved_args_t* pArgs ///< [in] Argument containing information + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_base_interface_t +typedef struct _ctl_base_interface_t ctl_base_interface_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_range_info_t +typedef struct _ctl_property_range_info_t ctl_property_range_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_range_info_int_t +typedef struct _ctl_property_range_info_int_t ctl_property_range_info_int_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_range_info_uint_t +typedef struct _ctl_property_range_info_uint_t ctl_property_range_info_uint_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_info_boolean_t +typedef struct _ctl_property_info_boolean_t ctl_property_info_boolean_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_boolean_t +typedef struct _ctl_property_boolean_t ctl_property_boolean_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_info_enum_t +typedef struct _ctl_property_info_enum_t ctl_property_info_enum_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_enum_t +typedef struct _ctl_property_enum_t ctl_property_enum_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_info_float_t +typedef struct _ctl_property_info_float_t ctl_property_info_float_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_float_t +typedef struct _ctl_property_float_t ctl_property_float_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_info_int_t +typedef struct _ctl_property_info_int_t ctl_property_info_int_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_int_t +typedef struct _ctl_property_int_t ctl_property_int_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_info_uint_t +typedef struct _ctl_property_info_uint_t ctl_property_info_uint_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_property_uint_t +typedef struct _ctl_property_uint_t ctl_property_uint_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_base_properties_t +typedef struct _ctl_base_properties_t ctl_base_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_application_id_t +typedef struct _ctl_application_id_t ctl_application_id_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_init_args_t +typedef struct _ctl_init_args_t ctl_init_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_reserved_args_t +typedef struct _ctl_reserved_args_t ctl_reserved_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_reserved_args_base_t +typedef struct _ctl_reserved_args_base_t ctl_reserved_args_base_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_unlock_capability_t +typedef struct _ctl_unlock_capability_t ctl_unlock_capability_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_runtime_path_args_t +typedef struct _ctl_runtime_path_args_t ctl_runtime_path_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_firmware_version_t +typedef struct _ctl_firmware_version_t ctl_firmware_version_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_adapter_bdf_t +typedef struct _ctl_adapter_bdf_t ctl_adapter_bdf_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_device_adapter_properties_t +typedef struct _ctl_device_adapter_properties_t ctl_device_adapter_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_generic_void_datatype_t +typedef struct _ctl_generic_void_datatype_t ctl_generic_void_datatype_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_revision_datatype_t +typedef struct _ctl_revision_datatype_t ctl_revision_datatype_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_wait_property_change_args_t +typedef struct _ctl_wait_property_change_args_t ctl_wait_property_change_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_rect_t +typedef struct _ctl_rect_t ctl_rect_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_endurance_gaming_caps_t +typedef struct _ctl_endurance_gaming_caps_t ctl_endurance_gaming_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_endurance_gaming_t +typedef struct _ctl_endurance_gaming_t ctl_endurance_gaming_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_endurance_gaming2_t +typedef struct _ctl_endurance_gaming2_t ctl_endurance_gaming2_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_adaptivesync_caps_t +typedef struct _ctl_adaptivesync_caps_t ctl_adaptivesync_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_adaptivesync_getset_t +typedef struct _ctl_adaptivesync_getset_t ctl_adaptivesync_getset_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_3d_app_profiles_caps_t +typedef struct _ctl_3d_app_profiles_caps_t ctl_3d_app_profiles_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_3d_app_profiles_t +typedef struct _ctl_3d_app_profiles_t ctl_3d_app_profiles_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_3d_tier_details_t +typedef struct _ctl_3d_tier_details_t ctl_3d_tier_details_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_3d_feature_details_t +typedef struct _ctl_3d_feature_details_t ctl_3d_feature_details_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_3d_feature_caps_t +typedef struct _ctl_3d_feature_caps_t ctl_3d_feature_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_3d_feature_getset_t +typedef struct _ctl_3d_feature_getset_t ctl_3d_feature_getset_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_kmd_load_features_t +typedef struct _ctl_kmd_load_features_t ctl_kmd_load_features_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_display_timing_t +typedef struct _ctl_display_timing_t ctl_display_timing_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_display_properties_t +typedef struct _ctl_display_properties_t ctl_display_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_adapter_display_encoder_properties_t +typedef struct _ctl_adapter_display_encoder_properties_t ctl_adapter_display_encoder_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_sharpness_filter_properties_t +typedef struct _ctl_sharpness_filter_properties_t ctl_sharpness_filter_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_sharpness_caps_t +typedef struct _ctl_sharpness_caps_t ctl_sharpness_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_sharpness_settings_t +typedef struct _ctl_sharpness_settings_t ctl_sharpness_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_i2c_access_args_t +typedef struct _ctl_i2c_access_args_t ctl_i2c_access_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_i2c_access_pinpair_args_t +typedef struct _ctl_i2c_access_pinpair_args_t ctl_i2c_access_pinpair_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_aux_access_args_t +typedef struct _ctl_aux_access_args_t ctl_aux_access_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_optimization_caps_t +typedef struct _ctl_power_optimization_caps_t ctl_power_optimization_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_optimization_lrr_t +typedef struct _ctl_power_optimization_lrr_t ctl_power_optimization_lrr_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_optimization_psr_t +typedef struct _ctl_power_optimization_psr_t ctl_power_optimization_psr_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_optimization_dpst_t +typedef struct _ctl_power_optimization_dpst_t ctl_power_optimization_dpst_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_optimization_settings_t +typedef struct _ctl_power_optimization_settings_t ctl_power_optimization_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_set_brightness_t +typedef struct _ctl_set_brightness_t ctl_set_brightness_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_get_brightness_t +typedef struct _ctl_get_brightness_t ctl_get_brightness_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pixtx_color_primaries_t +typedef struct _ctl_pixtx_color_primaries_t ctl_pixtx_color_primaries_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pixtx_pixel_format_t +typedef struct _ctl_pixtx_pixel_format_t ctl_pixtx_pixel_format_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pixtx_1dlut_config_t +typedef struct _ctl_pixtx_1dlut_config_t ctl_pixtx_1dlut_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pixtx_matrix_config_t +typedef struct _ctl_pixtx_matrix_config_t ctl_pixtx_matrix_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pixtx_3dlut_sample_t +typedef struct _ctl_pixtx_3dlut_sample_t ctl_pixtx_3dlut_sample_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pixtx_3dlut_config_t +typedef struct _ctl_pixtx_3dlut_config_t ctl_pixtx_3dlut_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pixtx_block_config_t +typedef struct _ctl_pixtx_block_config_t ctl_pixtx_block_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pixtx_pipe_get_config_t +typedef struct _ctl_pixtx_pipe_get_config_t ctl_pixtx_pipe_get_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pixtx_pipe_set_config_t +typedef struct _ctl_pixtx_pipe_set_config_t ctl_pixtx_pipe_set_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_panel_descriptor_access_args_t +typedef struct _ctl_panel_descriptor_access_args_t ctl_panel_descriptor_access_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_retro_scaling_settings_t +typedef struct _ctl_retro_scaling_settings_t ctl_retro_scaling_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_retro_scaling_caps_t +typedef struct _ctl_retro_scaling_caps_t ctl_retro_scaling_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_scaling_caps_t +typedef struct _ctl_scaling_caps_t ctl_scaling_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_scaling_settings_t +typedef struct _ctl_scaling_settings_t ctl_scaling_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_lace_lux_aggr_map_entry_t +typedef struct _ctl_lace_lux_aggr_map_entry_t ctl_lace_lux_aggr_map_entry_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_lace_lux_aggr_map_t +typedef struct _ctl_lace_lux_aggr_map_t ctl_lace_lux_aggr_map_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_lace_config_t +typedef struct _ctl_lace_config_t ctl_lace_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_sw_psr_settings_t +typedef struct _ctl_sw_psr_settings_t ctl_sw_psr_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_intel_arc_sync_monitor_params_t +typedef struct _ctl_intel_arc_sync_monitor_params_t ctl_intel_arc_sync_monitor_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_mux_properties_t +typedef struct _ctl_mux_properties_t ctl_mux_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_intel_arc_sync_profile_params_t +typedef struct _ctl_intel_arc_sync_profile_params_t ctl_intel_arc_sync_profile_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_edid_management_args_t +typedef struct _ctl_edid_management_args_t ctl_edid_management_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_get_set_custom_mode_args_t +typedef struct _ctl_get_set_custom_mode_args_t ctl_get_set_custom_mode_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_custom_src_mode_t +typedef struct _ctl_custom_src_mode_t ctl_custom_src_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_child_display_target_mode_t +typedef struct _ctl_child_display_target_mode_t ctl_child_display_target_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_combined_display_child_info_t +typedef struct _ctl_combined_display_child_info_t ctl_combined_display_child_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_combined_display_args_t +typedef struct _ctl_combined_display_args_t ctl_combined_display_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_genlock_display_info_t +typedef struct _ctl_genlock_display_info_t ctl_genlock_display_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_genlock_target_mode_list_t +typedef struct _ctl_genlock_target_mode_list_t ctl_genlock_target_mode_list_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_genlock_topology_t +typedef struct _ctl_genlock_topology_t ctl_genlock_topology_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_genlock_args_t +typedef struct _ctl_genlock_args_t ctl_genlock_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_vblank_ts_args_t +typedef struct _ctl_vblank_ts_args_t ctl_vblank_ts_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_lda_args_t +typedef struct _ctl_lda_args_t ctl_lda_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_dce_args_t +typedef struct _ctl_dce_args_t ctl_dce_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_wire_format_t +typedef struct _ctl_wire_format_t ctl_wire_format_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_get_set_wire_format_config_t +typedef struct _ctl_get_set_wire_format_config_t ctl_get_set_wire_format_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_display_settings_t +typedef struct _ctl_display_settings_t ctl_display_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_engine_properties_t +typedef struct _ctl_engine_properties_t ctl_engine_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_engine_stats_t +typedef struct _ctl_engine_stats_t ctl_engine_stats_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_fan_speed_t +typedef struct _ctl_fan_speed_t ctl_fan_speed_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_fan_temp_speed_t +typedef struct _ctl_fan_temp_speed_t ctl_fan_temp_speed_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_fan_speed_table_t +typedef struct _ctl_fan_speed_table_t ctl_fan_speed_table_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_fan_properties_t +typedef struct _ctl_fan_properties_t ctl_fan_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_fan_config_t +typedef struct _ctl_fan_config_t ctl_fan_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_freq_properties_t +typedef struct _ctl_freq_properties_t ctl_freq_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_freq_range_t +typedef struct _ctl_freq_range_t ctl_freq_range_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_freq_state_t +typedef struct _ctl_freq_state_t ctl_freq_state_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_freq_throttle_time_t +typedef struct _ctl_freq_throttle_time_t ctl_freq_throttle_time_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_super_resolution_info_t +typedef struct _ctl_video_processing_super_resolution_info_t ctl_video_processing_super_resolution_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_super_resolution_t +typedef struct _ctl_video_processing_super_resolution_t ctl_video_processing_super_resolution_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_noise_reduction_info_t +typedef struct _ctl_video_processing_noise_reduction_info_t ctl_video_processing_noise_reduction_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_noise_reduction_t +typedef struct _ctl_video_processing_noise_reduction_t ctl_video_processing_noise_reduction_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_adaptive_contrast_enhancement_info_t +typedef struct _ctl_video_processing_adaptive_contrast_enhancement_info_t ctl_video_processing_adaptive_contrast_enhancement_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_adaptive_contrast_enhancement_t +typedef struct _ctl_video_processing_adaptive_contrast_enhancement_t ctl_video_processing_adaptive_contrast_enhancement_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_standard_color_correction_info_t +typedef struct _ctl_video_processing_standard_color_correction_info_t ctl_video_processing_standard_color_correction_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_standard_color_correction_t +typedef struct _ctl_video_processing_standard_color_correction_t ctl_video_processing_standard_color_correction_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_total_color_correction_info_t +typedef struct _ctl_video_processing_total_color_correction_info_t ctl_video_processing_total_color_correction_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_total_color_correction_t +typedef struct _ctl_video_processing_total_color_correction_t ctl_video_processing_total_color_correction_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_feature_details_t +typedef struct _ctl_video_processing_feature_details_t ctl_video_processing_feature_details_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_feature_caps_t +typedef struct _ctl_video_processing_feature_caps_t ctl_video_processing_feature_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_video_processing_feature_getset_t +typedef struct _ctl_video_processing_feature_getset_t ctl_video_processing_feature_getset_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_mem_properties_t +typedef struct _ctl_mem_properties_t ctl_mem_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_mem_state_t +typedef struct _ctl_mem_state_t ctl_mem_state_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_mem_bandwidth_t +typedef struct _ctl_mem_bandwidth_t ctl_mem_bandwidth_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_oc_telemetry_item_t +typedef struct _ctl_oc_telemetry_item_t ctl_oc_telemetry_item_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_oc_control_info_t +typedef struct _ctl_oc_control_info_t ctl_oc_control_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_oc_properties_t +typedef struct _ctl_oc_properties_t ctl_oc_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_oc_vf_pair_t +typedef struct _ctl_oc_vf_pair_t ctl_oc_vf_pair_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_psu_info_t +typedef struct _ctl_psu_info_t ctl_psu_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_telemetry_t +typedef struct _ctl_power_telemetry_t ctl_power_telemetry_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pci_address_t +typedef struct _ctl_pci_address_t ctl_pci_address_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pci_speed_t +typedef struct _ctl_pci_speed_t ctl_pci_speed_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pci_properties_t +typedef struct _ctl_pci_properties_t ctl_pci_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_pci_state_t +typedef struct _ctl_pci_state_t ctl_pci_state_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_properties_t +typedef struct _ctl_power_properties_t ctl_power_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_energy_counter_t +typedef struct _ctl_power_energy_counter_t ctl_power_energy_counter_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_sustained_limit_t +typedef struct _ctl_power_sustained_limit_t ctl_power_sustained_limit_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_burst_limit_t +typedef struct _ctl_power_burst_limit_t ctl_power_burst_limit_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_peak_limit_t +typedef struct _ctl_power_peak_limit_t ctl_power_peak_limit_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_power_limits_t +typedef struct _ctl_power_limits_t ctl_power_limits_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_energy_threshold_t +typedef struct _ctl_energy_threshold_t ctl_energy_threshold_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_temp_properties_t +typedef struct _ctl_temp_properties_t ctl_temp_properties_t; + + + +#if !defined(__GNUC__) +#pragma endregion // common +#endif +// Intel 'ctlApi' for Device Adapter +#if !defined(__GNUC__) +#pragma region _3D +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Feature type +typedef enum _ctl_3d_feature_t +{ + CTL_3D_FEATURE_FRAME_PACING = 0, ///< Frame pacing. Contains generic enum type fields + CTL_3D_FEATURE_ENDURANCE_GAMING = 1, ///< Endurance gaming. Contains generic integer type fields. Value will be + ///< interpreted as the max FPS to be used when in DC mode globally or per + ///< application + CTL_3D_FEATURE_FRAME_LIMIT = 2, ///< Frame limit for games. Contains generic integer type fields. Value + ///< will be interpreted as the max FPS to be used independent of system + ///< power state + CTL_3D_FEATURE_ANISOTROPIC = 3, ///< ANISOTROPIC. Contains generic enum type fields + CTL_3D_FEATURE_CMAA = 4, ///< CMAA. Contains generic enum type fields + CTL_3D_FEATURE_TEXTURE_FILTERING_QUALITY = 5, ///< Texture filtering quality. Contains generic enum type fields + CTL_3D_FEATURE_ADAPTIVE_TESSELLATION = 6, ///< Adaptive tessellation quality. Contains generic integer type fields + CTL_3D_FEATURE_SHARPENING_FILTER = 7, ///< Sharpening Filter. Contains generic integer type fields + CTL_3D_FEATURE_MSAA = 8, ///< Msaa. Contains generic enum type fields + CTL_3D_FEATURE_GAMING_FLIP_MODES = 9, ///< Various Gaming flip modes like speed frame, smooth sync & force async + ///< flip. Contains generic enum type fields + CTL_3D_FEATURE_ADAPTIVE_SYNC_PLUS = 10, ///< Adaptive sync plus. Refer custom field ::ctl_adaptivesync_caps_t & + ///< ::ctl_adaptivesync_getset_t + CTL_3D_FEATURE_APP_PROFILES = 11, ///< Game Compatibility & Performance Profiles. Refer custom field + ///< ::ctl_3d_app_profiles_caps_t & ::ctl_3d_app_profiles_t + CTL_3D_FEATURE_APP_PROFILE_DETAILS = 12, ///< Game Profile Customization. Refer custom field ::ctl_3d_tier_details_t + CTL_3D_FEATURE_EMULATED_TYPED_64BIT_ATOMICS = 13, ///< Emulated Typed 64bit Atomics support in DG2 + CTL_3D_FEATURE_VRR_WINDOWED_BLT = 14, ///< VRR windowed blt. Control VRR for windowed mode game + CTL_3D_FEATURE_GLOBAL_OR_PER_APP = 15, ///< Set global settings or per application settings + CTL_3D_FEATURE_MAX + +} ctl_3d_feature_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief 3D feature misc flags +typedef uint32_t ctl_3d_feature_misc_flags_t; +typedef enum _ctl_3d_feature_misc_flag_t +{ + CTL_3D_FEATURE_MISC_FLAG_DX11 = CTL_BIT(0), ///< Feature supported on DX11 + CTL_3D_FEATURE_MISC_FLAG_DX12 = CTL_BIT(1), ///< Feature supported on DX12 + CTL_3D_FEATURE_MISC_FLAG_VULKAN = CTL_BIT(2), ///< Feature supported on VULKAN + CTL_3D_FEATURE_MISC_FLAG_LIVE_CHANGE = CTL_BIT(3), ///< User can change feature live without restarting the game + CTL_3D_FEATURE_MISC_FLAG_MAX = 0x80000000 + +} ctl_3d_feature_misc_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Anisotropic values possible +typedef enum _ctl_3d_anisotropic_types_t +{ + CTL_3D_ANISOTROPIC_TYPES_APP_CHOICE = 0, ///< Application choice + CTL_3D_ANISOTROPIC_TYPES_2X = 2, ///< 2X + CTL_3D_ANISOTROPIC_TYPES_4X = 4, ///< 4X + CTL_3D_ANISOTROPIC_TYPES_8X = 8, ///< 8X + CTL_3D_ANISOTROPIC_TYPES_16X = 16, ///< 16X + CTL_3D_ANISOTROPIC_TYPES_MAX + +} ctl_3d_anisotropic_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Texture filtering values possible +typedef enum _ctl_3d_texture_filtering_quality_types_t +{ + CTL_3D_TEXTURE_FILTERING_QUALITY_TYPES_PERFORMANCE = 0, ///< Performance + CTL_3D_TEXTURE_FILTERING_QUALITY_TYPES_BALANCED = 1,///< Balanced + CTL_3D_TEXTURE_FILTERING_QUALITY_TYPES_QUALITY = 2, ///< Quality + CTL_3D_TEXTURE_FILTERING_QUALITY_TYPES_MAX + +} ctl_3d_texture_filtering_quality_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Frame pacing values possible +typedef enum _ctl_3d_frame_pacing_types_t +{ + CTL_3D_FRAME_PACING_TYPES_DISABLE = 0, ///< Disable + CTL_3D_FRAME_PACING_TYPES_ENABLE_MODE_FRAME_NO_SMOOTHENING = 1, ///< Enable with scheduler without any frame smoothening + CTL_3D_FRAME_PACING_TYPES_ENABLE_MODE_FRAME_MAX_SMOOTHENING = 2,///< Enable with scheduler with maximum smoothness + CTL_3D_FRAME_PACING_TYPES_ENABLE_MODE_COMPETITIVE_GAMING = 3, ///< Enable with scheduler in competitive gaming mode + CTL_3D_FRAME_PACING_TYPES_MAX + +} ctl_3d_frame_pacing_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Endurance Gaming control possible +typedef enum _ctl_3d_endurance_gaming_control_t +{ + CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_OFF = 0, ///< Endurance Gaming disable + CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_ON = 1, ///< Endurance Gaming enable + CTL_3D_ENDURANCE_GAMING_CONTROL_AUTO = 2, ///< Endurance Gaming auto + CTL_3D_ENDURANCE_GAMING_CONTROL_MAX + +} ctl_3d_endurance_gaming_control_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Endurance Gaming modes possible +typedef enum _ctl_3d_endurance_gaming_mode_t +{ + CTL_3D_ENDURANCE_GAMING_MODE_BETTER_PERFORMANCE = 0,///< Endurance Gaming better performance mode + CTL_3D_ENDURANCE_GAMING_MODE_BALANCED = 1, ///< Endurance Gaming balanced mode + CTL_3D_ENDURANCE_GAMING_MODE_MAXIMUM_BATTERY = 2, ///< Endurance Gaming maximum battery mode + CTL_3D_ENDURANCE_GAMING_MODE_MAX + +} ctl_3d_endurance_gaming_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Cmaa values possible +typedef enum _ctl_3d_cmaa_types_t +{ + CTL_3D_CMAA_TYPES_TURN_OFF = 0, ///< Turn off + CTL_3D_CMAA_TYPES_OVERRIDE_MSAA = 1, ///< Override MSAA + CTL_3D_CMAA_TYPES_ENHANCE_APPLICATION = 2, ///< Enhance Application + CTL_3D_CMAA_TYPES_MAX + +} ctl_3d_cmaa_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Adaptive Tessellation +typedef enum _ctl_3d_adaptive_tessellation_types_t +{ + CTL_3D_ADAPTIVE_TESSELLATION_TYPES_TURN_OFF = 0,///< Turn off + CTL_3D_ADAPTIVE_TESSELLATION_TYPES_TURN_ON = 1, ///< Turn on + CTL_3D_ADAPTIVE_TESSELLATION_TYPES_MAX + +} ctl_3d_adaptive_tessellation_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Sharpening filter values possible +typedef enum _ctl_3d_sharpening_filter_types_t +{ + CTL_3D_SHARPENING_FILTER_TYPES_TURN_OFF = 0, ///< Turn off + CTL_3D_SHARPENING_FILTER_TYPES_TURN_ON = 1, ///< Turn on + CTL_3D_SHARPENING_FILTER_TYPES_MAX + +} ctl_3d_sharpening_filter_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief MSAA values possible +typedef enum _ctl_3d_msaa_types_t +{ + CTL_3D_MSAA_TYPES_APP_CHOICE = 0, ///< Application choice + CTL_3D_MSAA_TYPES_DISABLED = 1, ///< Disabled. MSAA count 1 + CTL_3D_MSAA_TYPES_2X = 2, ///< 2X + CTL_3D_MSAA_TYPES_4X = 4, ///< 4X + CTL_3D_MSAA_TYPES_8X = 8, ///< 8X + CTL_3D_MSAA_TYPES_16X = 16, ///< 16X + CTL_3D_MSAA_TYPES_MAX + +} ctl_3d_msaa_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Gaming flip modes +typedef uint32_t ctl_gaming_flip_mode_flags_t; +typedef enum _ctl_gaming_flip_mode_flag_t +{ + CTL_GAMING_FLIP_MODE_FLAG_APPLICATION_DEFAULT = CTL_BIT(0), ///< Application Default + CTL_GAMING_FLIP_MODE_FLAG_VSYNC_OFF = CTL_BIT(1), ///< Convert all sync flips to async on the next possible scanline. + CTL_GAMING_FLIP_MODE_FLAG_VSYNC_ON = CTL_BIT(2),///< Convert all async flips to sync flips. + CTL_GAMING_FLIP_MODE_FLAG_SMOOTH_SYNC = CTL_BIT(3), ///< Reduce tearing effect with async flips + CTL_GAMING_FLIP_MODE_FLAG_SPEED_FRAME = CTL_BIT(4), ///< Application unaware triple buffering + CTL_GAMING_FLIP_MODE_FLAG_CAPPED_FPS = CTL_BIT(5), ///< Limit the game FPS to panel RR + CTL_GAMING_FLIP_MODE_FLAG_MAX = 0x80000000 + +} ctl_gaming_flip_mode_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Endurance Gaming caps +typedef struct _ctl_endurance_gaming_caps_t +{ + ctl_property_info_enum_t EGControlCaps; ///< [out] Endurance Gaming control capability + ctl_property_info_enum_t EGModeCaps; ///< [out] Endurance Gaming mode capability + +} ctl_endurance_gaming_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Endurance Gaming Get/Set +typedef struct _ctl_endurance_gaming_t +{ + ctl_3d_endurance_gaming_control_t EGControl; ///< [in,out] Endurance Gaming control - Off/On/Auto + ctl_3d_endurance_gaming_mode_t EGMode; ///< [in,out] Endurance Gaming mode - Better Performance/Balanced/Maximum + ///< Battery + +} ctl_endurance_gaming_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Endurance Gaming version2 Get/Set +typedef struct _ctl_endurance_gaming2_t +{ + ctl_3d_endurance_gaming_control_t EGControl; ///< [in,out] Endurance Gaming control - Off/On/Auto + ctl_3d_endurance_gaming_mode_t EGMode; ///< [in,out] Endurance Gaming mode - Better Performance/Balanced/Maximum + ///< Battery + bool IsFPRequired; ///< [out] Is frame pacing required, dynamic state + double TargetFPS; ///< [out] Target FPS for frame pacing + double RefreshRate; ///< [out] Refresh rate used to calculate target fps + uint32_t Reserved[4]; ///< [out] Reserved fields + +} ctl_endurance_gaming2_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Adaptive sync plus caps +typedef struct _ctl_adaptivesync_caps_t +{ + bool AdaptiveBalanceSupported; ///< [out] Adaptive balance supported + ctl_property_info_float_t AdaptiveBalanceStrengthCaps; ///< [out] Strength of adaptive balance algorithm - min/max/steps/default + +} ctl_adaptivesync_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Adaptive sync plus +typedef struct _ctl_adaptivesync_getset_t +{ + bool AdaptiveSync; ///< [in,out] Adaptive sync. Note that in Windows, OS controls state of + ///< adaptive sync and which game gets the feature using it's own policies + bool AdaptiveBalance; ///< [in,out] Adaptive balance + bool AllowAsyncForHighFPS; ///< [in,out] Allow async flips when FPS is higher than max refresh rate of + ///< the panel + float AdaptiveBalanceStrength; ///< [in,out] Adaptive balance strength + +} ctl_adaptivesync_getset_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Game tier types +typedef uint32_t ctl_3d_tier_type_flags_t; +typedef enum _ctl_3d_tier_type_flag_t +{ + CTL_3D_TIER_TYPE_FLAG_COMPATIBILITY = CTL_BIT(0), ///< Compatibility Tier + CTL_3D_TIER_TYPE_FLAG_PERFORMANCE = CTL_BIT(1), ///< Performance Tier + CTL_3D_TIER_TYPE_FLAG_MAX = 0x80000000 + +} ctl_3d_tier_type_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Game tiers +typedef uint32_t ctl_3d_tier_profile_flags_t; +typedef enum _ctl_3d_tier_profile_flag_t +{ + CTL_3D_TIER_PROFILE_FLAG_TIER_1 = CTL_BIT(0), ///< Tier 1 Profile + CTL_3D_TIER_PROFILE_FLAG_TIER_2 = CTL_BIT(1), ///< Tier 2 Profile + CTL_3D_TIER_PROFILE_FLAG_TIER_RECOMMENDED = CTL_BIT(30),///< Recommended Tier Profile. If set other tier values shouldn't be set + CTL_3D_TIER_PROFILE_FLAG_MAX = 0x80000000 + +} ctl_3d_tier_profile_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Game Profile Capabilities. Typically these remain the same across +/// games. +typedef struct _ctl_3d_app_profiles_caps_t +{ + ctl_3d_tier_type_flags_t SupportedTierTypes; ///< [out] Tier of interest for capability check + uint64_t Reserved; ///< [in,out] Reserved for future + +} ctl_3d_app_profiles_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Game Profile tiers +typedef struct _ctl_3d_app_profiles_t +{ + ctl_3d_tier_type_flag_t TierType; ///< [in] Tier type + ctl_3d_tier_profile_flags_t SupportedTierProfiles; ///< [out] Supported tier profiles bitmask + ctl_3d_tier_profile_flags_t DefaultEnabledTierProfiles; ///< [out] Default tiers which driver will enable if there is no user + ///< specific setting for global or per application + ctl_3d_tier_profile_flags_t CustomizationSupportedTierProfiles; ///< [out] Tiers supporting customization - reserved for future + ctl_3d_tier_profile_flags_t EnabledTierProfiles;///< [in,out] Tier profile(s) to be enabled/disabled in the case of a set + ///< call. For a get call this will return the currently enabled tiers + ctl_3d_tier_profile_flags_t CustomizationEnabledTierProfiles; ///< [in,out] Tier profile(s) which are customized. Caller shall call + ///< ::ctl_3d_tier_details_t to get specifics if any. + uint64_t Reserved; ///< [in,out] Reserved for future + +} ctl_3d_app_profiles_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Game Profile tiers details +typedef struct _ctl_3d_tier_details_t +{ + ctl_3d_tier_type_flag_t TierType; ///< [in] Tier type + ctl_3d_tier_profile_flag_t TierProfile; ///< [in] Tier profile(s) for get/set details + uint64_t Reserved[4]; ///< [in,out] Reserved for future + +} ctl_3d_tier_details_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Emulated Typed 64bit Atomics +typedef enum _ctl_emulated_typed_64bit_atomics_types_t +{ + CTL_EMULATED_TYPED_64BIT_ATOMICS_TYPES_DEFAULT = 0, ///< Default settings is based on workload/driver decision. + CTL_EMULATED_TYPED_64BIT_ATOMICS_TYPES_TURN_ON = 1, ///< Force Turn on + CTL_EMULATED_TYPED_64BIT_ATOMICS_TYPES_TURN_OFF = 2,///< Force Turn off + CTL_EMULATED_TYPED_64BIT_ATOMICS_TYPES_MAX + +} ctl_emulated_typed_64bit_atomics_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief VRR windowed BLT control possible. Reserved functionality +typedef enum _ctl_3d_vrr_windowed_blt_reserved_t +{ + CTL_3D_VRR_WINDOWED_BLT_RESERVED_AUTO = 0, ///< VRR windowed BLT auto + CTL_3D_VRR_WINDOWED_BLT_RESERVED_TURN_ON = 1, ///< VRR windowed BLT enable + CTL_3D_VRR_WINDOWED_BLT_RESERVED_TURN_OFF = 2, ///< VRR windowed BLT disable + CTL_3D_VRR_WINDOWED_BLT_RESERVED_MAX + +} ctl_3d_vrr_windowed_blt_reserved_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Global or per app values possible +typedef enum _ctl_3d_global_or_per_app_types_t +{ + CTL_3D_GLOBAL_OR_PER_APP_TYPES_NONE = 0, ///< none + CTL_3D_GLOBAL_OR_PER_APP_TYPES_PER_APP = 1, ///< Opt for per app settings + CTL_3D_GLOBAL_OR_PER_APP_TYPES_GLOBAL = 2, ///< Opt for global settings + CTL_3D_GLOBAL_OR_PER_APP_TYPES_MAX + +} ctl_3d_global_or_per_app_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief 3D feature capability details which will have range/supported and +/// default values +typedef struct _ctl_3d_feature_details_t +{ + ctl_3d_feature_t FeatureType; ///< [out] 3D feature type + ctl_property_value_type_t ValueType; ///< [out] Type of value + ctl_property_info_t Value; ///< [out] Union of various type of values for 3D features. For enum types + ///< this can be anisotropic/frame pacing etc. This member is valid iff + ///< ValueType is not CTL_PROPERTY_VALUE_TYPE_CUSTOM + int32_t CustomValueSize; ///< [in] CustomValue buffer size. Typically for a feature requiring custom + ///< struct, caller will know of it upfront and can provide the right size + ///< info here + void* pCustomValue; ///< [in,out] Pointer to a custom structure. Caller should allocate this + ///< buffer with known custom feature structure size. This member is valid + ///< iff ValueType is CTL_PROPERTY_VALUE_TYPE_CUSTOM + bool PerAppSupport; ///< [out] Flag indicating whether the feature is supported per application + ///< or not + int64_t ConflictingFeatures; ///< [out] Mask of ::ctl_3d_feature_t values which can't be enabled along + ///< with the mentioned FeatureType. If this is 0, it meant the feature + ///< doesn't have any conflicts with other features + int16_t FeatureMiscSupport; ///< [out] 3D Feature Miscellaneous support flags. This will be based on + ///< ::ctl_3d_feature_misc_flags_t + int16_t Reserved; ///< [out] Reserved + int16_t Reserved1; ///< [out] Reserved + int16_t Reserved2; ///< [out] Reserved + +} ctl_3d_feature_details_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief 3D feature which are controllable +typedef struct _ctl_3d_feature_caps_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t NumSupportedFeatures; ///< [in,out] Number of elements in supported features array + ctl_3d_feature_details_t* pFeatureDetails; ///< [in,out] Array of feature details + +} ctl_3d_feature_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief 3D feature for get/set +typedef struct _ctl_3d_feature_getset_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_3d_feature_t FeatureType; ///< [in] Features interested in + char* ApplicationName; ///< [in] Application name for which the property type is applicable. If + ///< this is an empty string then this will get/set global settings for the + ///< given adapter. Note that this should contain only the name of the + ///< application and not the system specific path + int8_t ApplicationNameLength; ///< [in] Length of ApplicationName string + bool bSet; ///< [in] Set this if it's a set call + ctl_property_value_type_t ValueType; ///< [in] Type of value. Caller has to ensure it provides the right value + ///< type which decides how one read the union structure below + ctl_property_t Value; ///< [in,out] Union of various type of values for 3D features. For enum + ///< types this can be anisotropic/frame pacing etc. This member is valid + ///< iff ValueType is not CTL_PROPERTY_VALUE_TYPE_CUSTOM + int32_t CustomValueSize; ///< [in] CustomValue buffer size. Typically for a feature requiring custom + ///< struct, caller will know of it upfront and cn provide the right size + ///< info here + void* pCustomValue; ///< [in,out] Pointer to a custom structure. Caller should allocate this + ///< buffer with known custom feature structure size. This member is valid + ///< iff ValueType is CTL_PROPERTY_VALUE_TYPE_CUSTOM + +} ctl_3d_feature_getset_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Load KMD gaming features. Restricted function +typedef struct _ctl_kmd_load_features_t +{ + ctl_application_id_t ReservedFuncID; ///< [in] Unique ID for reserved/special function + bool bLoad; ///< [in] If set, will load known KMD features. If not set will reset known + ///< KMD features to default + int64_t SubsetFeatureMask; ///< [in,out] Mask indicating the subset of KMD features within + ///< ::ctl_3d_feature_t values. Default of 0 indicate all KMD features + char* ApplicationName; ///< [in] Application name for which the KMD properties are loaded for. If + ///< this is an empty string then this will load global settings for the + ///< given adapter. Note that this should contain only the name of the + ///< application and not the system specific path + int8_t ApplicationNameLength; ///< [in] Length of ApplicationName string + int8_t CallerComponent; ///< [in] Caller component + int64_t Reserved[4]; ///< [in] Reserved field + +} ctl_kmd_load_features_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get 3D capabilities +/// +/// @details +/// - The application gets 3D properties +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pFeatureCaps` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSupported3DCapabilities( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_3d_feature_caps_t* pFeatureCaps ///< [in,out][release] 3D properties + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set 3D feature +/// +/// @details +/// - 3D feature details +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pFeature` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSet3DFeature( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_3d_feature_getset_t* pFeature ///< [in][release] 3D feature get/set parameter + ); + + +#if !defined(__GNUC__) +#pragma endregion // _3D +#endif +// Intel 'ctlApi' for Device Adapter +#if !defined(__GNUC__) +#pragma region display +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a display output instance +typedef struct _ctl_display_output_handle_t *ctl_display_output_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a i2c pin-pair instance +typedef struct _ctl_i2c_pin_pair_handle_t *ctl_i2c_pin_pair_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Check Driver version +/// +/// @details +/// - The application checks driver version +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlCheckDriverVersion( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + ctl_version_info_t version_info ///< [in][release] Driver version info + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enumerate devices +/// +/// @details +/// - The application enumerates all device adapters in the system +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hAPIHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumerateDevices( + ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned + ///< by the CtlInit function + uint32_t* pCount, ///< [in,out][release] pointer to the number of device instances. If count + ///< is zero, then the api will update the value with the total + ///< number of drivers available. If count is non-zero, then the api will + ///< only retrieve the number of drivers. + ///< If count is larger than the number of drivers available, then the api + ///< will update the value with the correct number of drivers available. + ctl_device_adapter_handle_t* phDevices ///< [in,out][optional][release][range(0, *pCount)] array of driver + ///< instance handles + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enumerate display outputs +/// +/// @details +/// - Enumerates display output capabilities +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumerateDisplayOutputs( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + uint32_t* pCount, ///< [in,out][release] pointer to the number of display output instances. + ///< If count is zero, then the api will update the value with the total + ///< number of outputs available. If count is non-zero, then the api will + ///< only retrieve the number of outputs. + ///< If count is larger than the number of drivers available, then the api + ///< will update the value with the correct number of drivers available. + ctl_display_output_handle_t* phDisplayOutputs ///< [in,out][optional][release][range(0, *pCount)] array of display output + ///< instance handles + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enumerate I2C Pin Pairs +/// +/// @details +/// - Returns available list of I2C Pin-Pairs on a requested adapter +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "The incoming pointer pCount is null" +/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "The supplied Count is not equal to actual number of i2c pin-pair instances" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumerateI2CPinPairs( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to device adapter + uint32_t* pCount, ///< [in,out][release] pointer to the number of i2c pin-pair instances. If + ///< count is zero, then the api will update the value with the total + ///< number of i2c pin-pair instances available. If count is non-zero and + ///< matches the avaialble number of pin-pairs, then the api will only + ///< return the avaialble number of i2c pin-pair instances in phI2cPinPairs. + ctl_i2c_pin_pair_handle_t* phI2cPinPairs ///< [out][optional][release][range(0, *pCount)] array of i2c pin pair + ///< instance handles. Need to be allocated by Caller when supplying the + ///< *pCount > 0. + ///< If Count is not equal to actual number of i2c pin-pair instances, it + ///< will return CTL_RESULT_ERROR_INVALID_SIZE. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief OS specific Display identifiers +typedef union _ctl_os_display_encoder_identifier_t +{ + uint32_t WindowsDisplayEncoderID; ///< [out] Windows OS Display encoder ID + ctl_generic_void_datatype_t DisplayEncoderID; ///< [out] Display encoder ID for non-windows OS + +} ctl_os_display_encoder_identifier_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Various display types +typedef enum _ctl_display_output_types_t +{ + CTL_DISPLAY_OUTPUT_TYPES_INVALID = 0, ///< Invalid + CTL_DISPLAY_OUTPUT_TYPES_DISPLAYPORT = 1, ///< DisplayPort + CTL_DISPLAY_OUTPUT_TYPES_HDMI = 2, ///< HDMI + CTL_DISPLAY_OUTPUT_TYPES_DVI = 3, ///< DVI + CTL_DISPLAY_OUTPUT_TYPES_MIPI = 4, ///< MIPI + CTL_DISPLAY_OUTPUT_TYPES_CRT = 5, ///< CRT + CTL_DISPLAY_OUTPUT_TYPES_MAX + +} ctl_display_output_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Supported output bits per color (bpc) bitmasks +typedef uint32_t ctl_output_bpc_flags_t; +typedef enum _ctl_output_bpc_flag_t +{ + CTL_OUTPUT_BPC_FLAG_6BPC = CTL_BIT(0), ///< [out] Is 6bpc supported + CTL_OUTPUT_BPC_FLAG_8BPC = CTL_BIT(1), ///< [out] Is 8bpc supported + CTL_OUTPUT_BPC_FLAG_10BPC = CTL_BIT(2), ///< [out] Is 10bpc supported + CTL_OUTPUT_BPC_FLAG_12BPC = CTL_BIT(3), ///< [out] Is 12bpc supported + CTL_OUTPUT_BPC_FLAG_MAX = 0x80000000 + +} ctl_output_bpc_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Display output features. This will indicate only the high level +/// capabilities +typedef uint32_t ctl_std_display_feature_flags_t; +typedef enum _ctl_std_display_feature_flag_t +{ + CTL_STD_DISPLAY_FEATURE_FLAG_HDCP = CTL_BIT(0), ///< [out] Is HDCP supported + CTL_STD_DISPLAY_FEATURE_FLAG_HD_AUDIO = CTL_BIT(1), ///< [out] Is HD Audio supported + CTL_STD_DISPLAY_FEATURE_FLAG_PSR = CTL_BIT(2), ///< [out] Is VESA PSR supported + CTL_STD_DISPLAY_FEATURE_FLAG_ADAPTIVESYNC_VRR = CTL_BIT(3), ///< [out] Is VESA Adaptive Sync or HDMI VRR supported + CTL_STD_DISPLAY_FEATURE_FLAG_VESA_COMPRESSION = CTL_BIT(4), ///< [out] Is display compression (VESA DSC) supported + CTL_STD_DISPLAY_FEATURE_FLAG_HDR = CTL_BIT(5), ///< [out] Is HDR supported + CTL_STD_DISPLAY_FEATURE_FLAG_HDMI_QMS = CTL_BIT(6), ///< [out] Is HDMI QMS supported + CTL_STD_DISPLAY_FEATURE_FLAG_HDR10_PLUS_CERTIFIED = CTL_BIT(7), ///< [out] Is HDR10+ certified + CTL_STD_DISPLAY_FEATURE_FLAG_VESA_HDR_CERTIFIED = CTL_BIT(8), ///< [out] Is VESA HDR certified - for future use + CTL_STD_DISPLAY_FEATURE_FLAG_MAX = 0x80000000 + +} ctl_std_display_feature_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Advanced Graphics Features provided by Intel Graphics Adapter. This +/// will indicate only the high level capabilities +typedef uint32_t ctl_intel_display_feature_flags_t; +typedef enum _ctl_intel_display_feature_flag_t +{ + CTL_INTEL_DISPLAY_FEATURE_FLAG_DPST = CTL_BIT(0), ///< [out] Is DPST supported + CTL_INTEL_DISPLAY_FEATURE_FLAG_LACE = CTL_BIT(1), ///< [out] Is LACE supported + CTL_INTEL_DISPLAY_FEATURE_FLAG_DRRS = CTL_BIT(2), ///< [out] Is DRRS supported + CTL_INTEL_DISPLAY_FEATURE_FLAG_ARC_ADAPTIVE_SYNC_CERTIFIED = CTL_BIT(3),///< [out] Is Intel Arc certified adaptive sync display + CTL_INTEL_DISPLAY_FEATURE_FLAG_MAX = 0x80000000 + +} ctl_intel_display_feature_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Attached Display Mux Type +typedef enum _ctl_attached_display_mux_type_t +{ + CTL_ATTACHED_DISPLAY_MUX_TYPE_NATIVE = 0, ///< [out] Native DP / HDMI + CTL_ATTACHED_DISPLAY_MUX_TYPE_THUNDERBOLT = 1, ///< [out] Thunderbolt + CTL_ATTACHED_DISPLAY_MUX_TYPE_TYPE_C = 2, ///< [out] USB Type C + CTL_ATTACHED_DISPLAY_MUX_TYPE_USB4 = 3, ///< [out] USB4 + CTL_ATTACHED_DISPLAY_MUX_TYPE_MAX + +} ctl_attached_display_mux_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Signal Standard +typedef enum _ctl_signal_standard_type_t +{ + CTL_SIGNAL_STANDARD_TYPE_UNKNOWN = 0, ///< [out] Unknown Signal Standard + CTL_SIGNAL_STANDARD_TYPE_CUSTOM = 1, ///< [out] Custom added timing + CTL_SIGNAL_STANDARD_TYPE_DMT = 2, ///< [out] DMT timing + CTL_SIGNAL_STANDARD_TYPE_GTF = 3, ///< [out] GTF Timing + CTL_SIGNAL_STANDARD_TYPE_CVT = 4, ///< [out] CVT Timing + CTL_SIGNAL_STANDARD_TYPE_CTA = 5, ///< [out] CTA Timing + CTL_SIGNAL_STANDARD_TYPE_MAX + +} ctl_signal_standard_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Protocol Converter Location +typedef uint32_t ctl_protocol_converter_location_flags_t; +typedef enum _ctl_protocol_converter_location_flag_t +{ + CTL_PROTOCOL_CONVERTER_LOCATION_FLAG_ONBOARD = CTL_BIT(0), ///< [out] OnBoard Protocol Converter + CTL_PROTOCOL_CONVERTER_LOCATION_FLAG_EXTERNAL = CTL_BIT(1), ///< [out] External Dongle + CTL_PROTOCOL_CONVERTER_LOCATION_FLAG_MAX = 0x80000000 + +} ctl_protocol_converter_location_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief [out] Display Output configuration related flags which indicate how +/// the output pixel stream drive the panel +typedef uint32_t ctl_display_config_flags_t; +typedef enum _ctl_display_config_flag_t +{ + CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ACTIVE = CTL_BIT(0),///< [out] DisplayActive 0: InActive 1: Active + CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ATTACHED = CTL_BIT(1), ///< [out] DisplayAttached.This Bit indicates if any dongle/display/hub is + ///< attached to the encoder. 0: Not Attached 1: Attached + CTL_DISPLAY_CONFIG_FLAG_IS_DONGLE_CONNECTED_TO_ENCODER = CTL_BIT(2),///< [out] This BIT will be set if a dongle/hub/onboard protocol converter + ///< , is attached to the encoder + CTL_DISPLAY_CONFIG_FLAG_DITHERING_ENABLED = CTL_BIT(3), ///< [out] This BIT will be set if dithering is enabled on the encoder + CTL_DISPLAY_CONFIG_FLAG_MAX = 0x80000000 + +} ctl_display_config_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief [out] Encoder configuration related flags which indicate how the +/// output pixel stream drive the panel +typedef uint32_t ctl_encoder_config_flags_t; +typedef enum _ctl_encoder_config_flag_t +{ + CTL_ENCODER_CONFIG_FLAG_INTERNAL_DISPLAY = CTL_BIT(0), ///< [out] Internal connection or not + CTL_ENCODER_CONFIG_FLAG_VESA_TILED_DISPLAY = CTL_BIT(1),///< [out] VESA DisplayID based tiled display which is driven by either + ///< multiple physical connections (DisplayPort SST) or virtual streams + ///< (DisplayPort MST) + CTL_ENCODER_CONFIG_FLAG_TYPEC_CAPABLE = CTL_BIT(2), ///< [out] This is set if encoder supports type c display + CTL_ENCODER_CONFIG_FLAG_TBT_CAPABLE = CTL_BIT(3), ///< [out] This is set if encoder supports Thunderbolt display + CTL_ENCODER_CONFIG_FLAG_DITHERING_SUPPORTED = CTL_BIT(4), ///< [out] This BIT will be set if encoder supports dithering + CTL_ENCODER_CONFIG_FLAG_VIRTUAL_DISPLAY = CTL_BIT(5), ///< [out] This BIT will be set if this is a virtual display.Hardware based + ///< features will not be applicable to this display.For collage display + ///< this will be set for the virtual output created by driver. For split + ///< display this will be set for the virtual split displays created out of + ///< one single physical display + CTL_ENCODER_CONFIG_FLAG_HIDDEN_DISPLAY = CTL_BIT(6),///< [out] This BIT will be set if display is hidden from OS + CTL_ENCODER_CONFIG_FLAG_COLLAGE_DISPLAY = CTL_BIT(7), ///< [out] This BIT will be set if this is a collage display + CTL_ENCODER_CONFIG_FLAG_SPLIT_DISPLAY = CTL_BIT(8), ///< [out] This BIT will be set if this is a split display + CTL_ENCODER_CONFIG_FLAG_COMPANION_DISPLAY = CTL_BIT(9), ///< [out] This BIT will be set if this is a companion display + CTL_ENCODER_CONFIG_FLAG_MGPU_COLLAGE_DISPLAY = CTL_BIT(10), ///< [out] This BIT will be set if this is a Multi GPU collage display + CTL_ENCODER_CONFIG_FLAG_MAX = 0x80000000 + +} ctl_encoder_config_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Display Timing +typedef struct _ctl_display_timing_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint64_t PixelClock; ///< [out] Pixel Clock in Hz + uint32_t HActive; ///< [out] Horizontal Active + uint32_t VActive; ///< [out] Vertical Active + uint32_t HTotal; ///< [out] Horizontal Total + uint32_t VTotal; ///< [out] Vertical Total + uint32_t HBlank; ///< [out] Horizontal Blank + uint32_t VBlank; ///< [out] Vertical Blank + uint32_t HSync; ///< [out] Horizontal Blank + uint32_t VSync; ///< [out] Vertical Blank + float RefreshRate; ///< [out] Refresh Rate + ctl_signal_standard_type_t SignalStandard; ///< [out] Signal Standard + uint8_t VicId; ///< [out] VIC ID for CTA timings + +} ctl_display_timing_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief This structure will contain the properties of the display currently +/// attached to the encoder. +typedef struct _ctl_display_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_os_display_encoder_identifier_t Os_display_encoder_handle; ///< [out] OS specific Display ID + ctl_display_output_types_t Type; ///< [out] Device Type from display HW stand point. If a DisplayPort + ///< protocol converter is involved, this will indicate it's DisplayPort. + ///< The protocol converter's output will be available from + ///< ProtocolConverterOutput field + ctl_attached_display_mux_type_t AttachedDisplayMuxType; ///< [out] Attached Display Mux Type + ctl_display_output_types_t ProtocolConverterOutput; ///< [out] Protocol output type which can be used if config flags indicate + ///< it's a protocol converter. If it's not a protocol converter this will + ///< be set to CTL_DISPLAY_OUTPUT_TYPES_INVALID + ctl_revision_datatype_t SupportedSpec; ///< [out] Supported industry spec version. + ctl_output_bpc_flags_t SupportedOutputBPCFlags; ///< [out] Supported output bits per color. Refer ::ctl_output_bpc_flag_t. + ///< This is independent of RGB or YCbCr output.This is the max BPC + ///< supported.BPC will vary per mode based on restrictions like bandwidth + ///< and monitor support + ctl_protocol_converter_location_flags_t ProtocolConverterType; ///< [out] Currently Active Protocol Converter. Refer + ///< ::ctl_protocol_converter_location_flag_t + ctl_display_config_flags_t DisplayConfigFlags; ///< [out] Output configuration related flags which indicate how the output + ///< pixel stream drive the panel. Refer ::ctl_display_config_flag_t + ctl_std_display_feature_flags_t FeatureEnabledFlags;///< [out] Enabled Display features.Refer ::ctl_std_display_feature_flag_t. + ctl_std_display_feature_flags_t FeatureSupportedFlags; ///< [out] Display Supported feature.Refer ::ctl_std_display_feature_flag_t + ctl_intel_display_feature_flags_t AdvancedFeatureEnabledFlags; ///< [out] Enabled advanced feature.Refer + ///< ::ctl_intel_display_feature_flag_t. + ctl_intel_display_feature_flags_t AdvancedFeatureSupportedFlags;///< [out] Supported advanced feature.Refer + ///< ::ctl_intel_display_feature_flag_t. + ctl_display_timing_t Display_Timing_Info; ///< [out] Applied Timing on the Display + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_display_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Adapter's display encoder properties +typedef struct _ctl_adapter_display_encoder_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_os_display_encoder_identifier_t Os_display_encoder_handle; ///< [out] OS specific Display ID + ctl_display_output_types_t Type; ///< [out] Device Type from display HW stand point. If a DisplayPort + ///< protocol converter is involved, this will indicate it's DisplayPort. + ///< The protocol converter's output will be available from + ///< ProtocolConverterOutput field + bool IsOnBoardProtocolConverterOutputPresent; ///< [out] Protocol output type which can be used if it's a protocol + ///< converter. If it's not a protocol converter this will be set to + ///< CTL_DISPLAY_OUTPUT_TYPES_INVALID + ctl_revision_datatype_t SupportedSpec; ///< [out] Supported industry spec version + ctl_output_bpc_flags_t SupportedOutputBPCFlags; ///< [out] Supported output bits per color. Refer ::ctl_output_bpc_flag_t. + ///< This is independent of RGB or YCbCr output.This is the max BPC + ///< supported.BPC will vary per mode based on restrictions like bandwidth + ///< and monitor support + ctl_encoder_config_flags_t EncoderConfigFlags; ///< [out] Output configuration related flags which indicate how the output + ///< pixel stream drive the panel. Refer ::ctl_encoder_config_flag_t + ///< Note: + ///< Virtual = 1: This indicates that its a software display. Hardware + ///< based features will not be applicable to this display. + ///< Collage=1,Virtual=1: Indicates the fake display output created by + ///< driver which has the combined resolution of multiple physical displays + ///< involved in collage configuration + ///< Collage=1,Virtual=0: Indicates the child physical displays involved + ///< in a collage configuration. These are real physical outputs + ///< Split=1,Virtual=1 : Indicates the fake display output created by + ///< driver which occupies a portion of a real physical display + ///< Split=1,Virtual=0 : Indicates the physical display which got split + ///< to form multiple split displays + ///< Split=1,Collage=1 : Invalid combination + ///< MgpuCollage=1,Collage=1,Virtual=1: Indicates the fake display + ///< output created by driver which has the combined resolution of multiple + ///< physical displays spread across multiple GPUs involved in Multi-GPU + ///< collage configuration + ///< MgpuCollage=1,Collage=1,Virtual=0: Indicates the child physical + ///< displays involved in a Multi-GPU collage configuration. These are real + ///< physical outputs + ctl_std_display_feature_flags_t FeatureSupportedFlags; ///< [out] Adapter Supported feature flags. Refer + ///< ::ctl_std_display_feature_flag_t + ctl_intel_display_feature_flags_t AdvancedFeatureSupportedFlags;///< [out] Advanced Features Supported by the Adapter. Refer + ///< ::ctl_intel_display_feature_flag_t + uint32_t ReservedFields[16]; ///< [out] Reserved field of 60 bytes + +} ctl_adapter_display_encoder_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Device Properties +/// +/// @details +/// - The application gets device properties +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetDeviceProperties( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to control device adapter + ctl_device_adapter_properties_t* pProperties ///< [in,out][release] Query result for device properties + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Display Properties +/// +/// @details +/// - The application gets display properties +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetDisplayProperties( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_display_properties_t* pProperties ///< [in,out][release] Query result for display properties + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Adapter Display encoder Properties +/// +/// @details +/// - The application gets the graphic adapters display encoder properties +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetAdaperDisplayEncoderProperties( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_adapter_display_encoder_properties_t* pProperties ///< [in,out][release] Query result for adapter display encoder properties + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Level0 Device handle +/// +/// @details +/// - The application gets OneAPI Level0 Device handles +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pZeDevice` +/// + `nullptr == hInstance` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetZeDevice( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + void* pZeDevice, ///< [out][release] ze_device handle + void** hInstance ///< [out][release] Module instance which caller can use to get export + ///< functions directly + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Various sharpness filter types +typedef uint32_t ctl_sharpness_filter_type_flags_t; +typedef enum _ctl_sharpness_filter_type_flag_t +{ + CTL_SHARPNESS_FILTER_TYPE_FLAG_NON_ADAPTIVE = CTL_BIT(0), ///< Non-adaptive sharpness + CTL_SHARPNESS_FILTER_TYPE_FLAG_ADAPTIVE = CTL_BIT(1), ///< Adaptive sharpness + CTL_SHARPNESS_FILTER_TYPE_FLAG_MAX = 0x80000000 + +} ctl_sharpness_filter_type_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Sharpness filter properties +typedef struct _ctl_sharpness_filter_properties_t +{ + ctl_sharpness_filter_type_flags_t FilterType; ///< [out] Filter type. Refer ::ctl_sharpness_filter_type_flag_t + ctl_property_range_info_t FilterDetails; ///< [out] Min, max & step size information + +} ctl_sharpness_filter_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Various sharpness filter types +typedef struct _ctl_sharpness_caps_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_sharpness_filter_type_flags_t SupportedFilterFlags; ///< [out] Supported sharpness filters for a given display output. Refer + ///< ::ctl_sharpness_filter_type_flag_t + uint8_t NumFilterTypes; ///< [out] Number of elements in filter properties array + ctl_sharpness_filter_properties_t* pFilterProperty; ///< [in,out] Array of filter properties structure describing supported + ///< filter capabilities. Caller should provide a pre-allocated memory for + ///< this. + +} ctl_sharpness_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Current sharpness setting +typedef struct _ctl_sharpness_settings_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool Enable; ///< [in,out] Current or new state of sharpness setting + ctl_sharpness_filter_type_flags_t FilterType; ///< [in,out] Current or new filter to be set. Refer + ///< ::ctl_sharpness_filter_type_flag_t + float Intensity; ///< [in,out] Setting intensity to be applied + +} ctl_sharpness_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Sharpness capability +/// +/// @details +/// - Returns sharpness capability +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSharpnessCaps` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSharpnessCaps( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_sharpness_caps_t* pSharpnessCaps ///< [in,out][release] Query result for sharpness capability + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Sharpness setting +/// +/// @details +/// - Returns current sharpness settings +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSharpnessSettings` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetCurrentSharpness( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_sharpness_settings_t* pSharpnessSettings ///< [in,out][release] Query result for sharpness current settings + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set Sharpness setting +/// +/// @details +/// - Set current sharpness settings +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSharpnessSettings` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlSetCurrentSharpness( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_sharpness_settings_t* pSharpnessSettings ///< [in][release] Set sharpness current settings + ); + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_I2C_MAX_DATA_SIZE +/// @brief I2C Maximum data size +#define CTL_I2C_MAX_DATA_SIZE 0x0080 +#endif // CTL_I2C_MAX_DATA_SIZE + +/////////////////////////////////////////////////////////////////////////////// +/// @brief I2C Access Args input Flags bitmasks +typedef uint32_t ctl_i2c_flags_t; +typedef enum _ctl_i2c_flag_t +{ + CTL_I2C_FLAG_ATOMICI2C = CTL_BIT(0), ///< Force Atomic I2C. + CTL_I2C_FLAG_1BYTE_INDEX = CTL_BIT(1), ///< 1-byte Indexed operation. If no Index Size flag set, decided based on + ///< Offset Value. + CTL_I2C_FLAG_2BYTE_INDEX = CTL_BIT(2), ///< 2-byte Indexed operation. If no Index Size flag set, decided based on + ///< Offset Value. + CTL_I2C_FLAG_4BYTE_INDEX = CTL_BIT(3), ///< 4-byte Indexed operation. If no Index Size flag set, decided based on + ///< Offset Value. + CTL_I2C_FLAG_SPEED_SLOW = CTL_BIT(4), ///< If no Speed Flag is set, defaults to Best Option possible. + CTL_I2C_FLAG_SPEED_FAST = CTL_BIT(5), ///< If no Speed Flag is set, defaults to Best Option possible. + CTL_I2C_FLAG_SPEED_BIT_BASH = CTL_BIT(6), ///< Uses Slower access using SW bit bashing method. If no Speed Flag is + ///< set, defaults to Best Option possible. + CTL_I2C_FLAG_MAX = 0x80000000 + +} ctl_i2c_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief I2C access arguments +typedef struct _ctl_i2c_access_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t DataSize; ///< [in,out] Valid data size + uint32_t Address; ///< [in] Address to read or write + ctl_operation_type_t OpType; ///< [in] Operation type, 1 for Read, 2 for Write, for Write operation, App + ///< needs to run with admin privileges + uint32_t Offset; ///< [in] Offset + ctl_i2c_flags_t Flags; ///< [in] I2C Flags. Refer ::ctl_i2c_flag_t + uint64_t RAD; ///< [in] RAD, For Future use, to be used for branch devices, Interface + ///< will be provided to get RAD + uint8_t Data[CTL_I2C_MAX_DATA_SIZE]; ///< [in,out] Data array + +} ctl_i2c_access_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief I2C Access +/// +/// @details +/// - Interface to access I2C using display handle as identifier. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pI2cAccessArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid I2C data size" +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlI2CAccess( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_i2c_access_args_t* pI2cAccessArgs ///< [in,out] I2c access arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief I2C Access on PinPair Args input Flags bitmasks +typedef uint32_t ctl_i2c_pinpair_flags_t; +typedef enum _ctl_i2c_pinpair_flag_t +{ + CTL_I2C_PINPAIR_FLAG_ATOMICI2C = CTL_BIT(0), ///< Force Atomic I2C. + CTL_I2C_PINPAIR_FLAG_1BYTE_INDEX = CTL_BIT(1), ///< 1-byte Indexed operation. If no Index Size flag set, decided based on + ///< Offset Value. + CTL_I2C_PINPAIR_FLAG_2BYTE_INDEX = CTL_BIT(2), ///< 2-byte Indexed operation. If no Index Size flag set, decided based on + ///< Offset Value. + CTL_I2C_PINPAIR_FLAG_4BYTE_INDEX = CTL_BIT(3), ///< 4-byte Indexed operation. If no Index Size flag set, decided based on + ///< Offset Value. + CTL_I2C_PINPAIR_FLAG_SPEED_SLOW = CTL_BIT(4), ///< If no Speed Flag is set, defaults to Best Option possible. + CTL_I2C_PINPAIR_FLAG_SPEED_FAST = CTL_BIT(5), ///< If no Speed Flag is set, defaults to Best Option possible. + CTL_I2C_PINPAIR_FLAG_SPEED_BIT_BASH = CTL_BIT(6), ///< Uses Slower access using SW bit bashing method. If no Speed Flag is + ///< set, defaults to Best Option possible. + CTL_I2C_PINPAIR_FLAG_MAX = 0x80000000 + +} ctl_i2c_pinpair_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief I2C access on Pin Pair arguments +typedef struct _ctl_i2c_access_pinpair_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t DataSize; ///< [in,out] Valid data size + uint32_t Address; ///< [in] Address to read or write + ctl_operation_type_t OpType; ///< [in] Operation type, 1 for Read, 2 for Write, for Write operation, App + ///< needs to run with admin privileges + uint32_t Offset; ///< [in] Offset + ctl_i2c_pinpair_flags_t Flags; ///< [in] I2C Flags. Refer ::ctl_i2c_pinpair_flag_t + uint8_t Data[CTL_I2C_MAX_DATA_SIZE]; ///< [in,out] Data array + uint32_t ReservedFields[4]; ///< [in] Reserved for future use, must be set to Zero. + +} ctl_i2c_access_pinpair_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief I2C Access On Pin Pair +/// +/// @details +/// - Interface to access I2C using pin-pair handle as identifier. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hI2cPinPair` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pI2cAccessArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid I2C data size" +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid Args passed" +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" +/// - ::CTL_RESULT_ERROR_EXTERNAL_DISPLAY_ATTACHED - "Write to Address not allowed when Display is connected" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlI2CAccessOnPinPair( + ctl_i2c_pin_pair_handle_t hI2cPinPair, ///< [in] Handle to I2C pin pair. + ctl_i2c_access_pinpair_args_t* pI2cAccessArgs ///< [in,out] I2c access arguments. + ); + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_AUX_MAX_DATA_SIZE +/// @brief Aux Maximum data size +#define CTL_AUX_MAX_DATA_SIZE 132 +#endif // CTL_AUX_MAX_DATA_SIZE + +/////////////////////////////////////////////////////////////////////////////// +/// @brief AUX Flags bitmasks +typedef uint32_t ctl_aux_flags_t; +typedef enum _ctl_aux_flag_t +{ + CTL_AUX_FLAG_NATIVE_AUX = CTL_BIT(0), ///< For Native AUX operation + CTL_AUX_FLAG_I2C_AUX = CTL_BIT(1), ///< For I2C AUX operation + CTL_AUX_FLAG_I2C_AUX_MOT = CTL_BIT(2), ///< For I2C AUX MOT operation + CTL_AUX_FLAG_MAX = 0x80000000 + +} ctl_aux_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief AUX access arguments +typedef struct _ctl_aux_access_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_operation_type_t OpType; ///< [in] Operation type, 1 for Read, 2 for Write, for Write operation, App + ///< needs to run with admin privileges + ctl_aux_flags_t Flags; ///< [in] Aux Flags. Refer ::ctl_aux_flag_t + uint32_t Address; ///< [in] Address to read or write + uint64_t RAD; ///< [in] RAD, For Future use, to be used for branch devices, Interface + ///< will be provided to get RAD + uint32_t PortID; ///< [in] Port ID, For Future use, to be used for SST tiled devices + uint32_t DataSize; ///< [in,out] Valid data size + uint8_t Data[CTL_AUX_MAX_DATA_SIZE]; ///< [in,out] Data array + +} ctl_aux_access_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Aux Access +/// +/// @details +/// - The application does Aux access, PSR needs to be disabled for AUX +/// call. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pAuxAccessArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid AUX data size" +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_INVALID_AUX_ACCESS_FLAG - "Invalid flag for AUX access" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlAUXAccess( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_aux_access_args_t* pAuxAccessArgs ///< [in,out] Aux access arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Power saving features (Each individual feature's set & get call can be +/// called only once at a time) +typedef uint32_t ctl_power_optimization_flags_t; +typedef enum _ctl_power_optimization_flag_t +{ + CTL_POWER_OPTIMIZATION_FLAG_FBC = CTL_BIT(0), ///< Frame buffer compression + CTL_POWER_OPTIMIZATION_FLAG_PSR = CTL_BIT(1), ///< Panel self refresh + CTL_POWER_OPTIMIZATION_FLAG_DPST = CTL_BIT(2), ///< Display power saving technology (Panel technology dependent) + CTL_POWER_OPTIMIZATION_FLAG_LRR = CTL_BIT(3), ///< Low refresh rate (LRR/ALRR/UBRR), UBRR is supported only for IGCC and + ///< NDA clients. UBZRR and UBLRR both can not be enabled at the same time, + ///< only one can be enabled at a given time + CTL_POWER_OPTIMIZATION_FLAG_LACE = CTL_BIT(4), ///< Lighting Aware Contrast Enhancement + CTL_POWER_OPTIMIZATION_FLAG_MAX = 0x80000000 + +} ctl_power_optimization_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief GPU/Panel/TCON dependent power optimization technology +typedef uint32_t ctl_power_optimization_dpst_flags_t; +typedef enum _ctl_power_optimization_dpst_flag_t +{ + CTL_POWER_OPTIMIZATION_DPST_FLAG_BKLT = CTL_BIT(0), ///< Intel DPST with Backlight control + CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC = CTL_BIT(1), ///< Panel TCON specific Content Adaptive Control mechanism + CTL_POWER_OPTIMIZATION_DPST_FLAG_OPST = CTL_BIT(2), ///< Intel OLED Power Saving Technology + CTL_POWER_OPTIMIZATION_DPST_FLAG_ELP = CTL_BIT(3), ///< TCON based Edge Luminance Profile + CTL_POWER_OPTIMIZATION_DPST_FLAG_EPSM = CTL_BIT(4), ///< Extra power saving mode + CTL_POWER_OPTIMIZATION_DPST_FLAG_APD = CTL_BIT(5), ///< Adaptive Pixel Dimming + CTL_POWER_OPTIMIZATION_DPST_FLAG_PIXOPTIX = CTL_BIT(6), ///< TCON+ based DPST like solution + CTL_POWER_OPTIMIZATION_DPST_FLAG_MAX = 0x80000000 + +} ctl_power_optimization_dpst_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Power Source +typedef enum _ctl_power_source_t +{ + CTL_POWER_SOURCE_AC = 0, ///< Power Source AC + CTL_POWER_SOURCE_DC = 1, ///< Power Source DC + CTL_POWER_SOURCE_MAX + +} ctl_power_source_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Power Optimization Plan +typedef enum _ctl_power_optimization_plan_t +{ + CTL_POWER_OPTIMIZATION_PLAN_BALANCED = 0, ///< Balanced mode + CTL_POWER_OPTIMIZATION_PLAN_HIGH_PERFORMANCE = 1, ///< High Performance Mode + CTL_POWER_OPTIMIZATION_PLAN_POWER_SAVER = 2, ///< Power Saver Mode + CTL_POWER_OPTIMIZATION_PLAN_MAX + +} ctl_power_optimization_plan_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Type of low refresh rate feature +typedef uint32_t ctl_power_optimization_lrr_flags_t; +typedef enum _ctl_power_optimization_lrr_flag_t +{ + CTL_POWER_OPTIMIZATION_LRR_FLAG_LRR10 = CTL_BIT(0), ///< LRR 1.0 + CTL_POWER_OPTIMIZATION_LRR_FLAG_LRR20 = CTL_BIT(1), ///< LRR 2.0 + CTL_POWER_OPTIMIZATION_LRR_FLAG_LRR25 = CTL_BIT(2), ///< LRR 2.5 + CTL_POWER_OPTIMIZATION_LRR_FLAG_ALRR = CTL_BIT(3), ///< Autonomous LRR + CTL_POWER_OPTIMIZATION_LRR_FLAG_UBLRR = CTL_BIT(4), ///< User based low refresh rate + CTL_POWER_OPTIMIZATION_LRR_FLAG_UBZRR = CTL_BIT(5), ///< User based zero refresh rate + CTL_POWER_OPTIMIZATION_LRR_FLAG_MAX = 0x80000000 + +} ctl_power_optimization_lrr_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Power optimization caps +typedef struct _ctl_power_optimization_caps_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_power_optimization_flags_t SupportedFeatures; ///< [out] Supported power optimization features. Refer + ///< ::ctl_power_optimization_flag_t + +} ctl_power_optimization_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Power optimization features +/// +/// @details +/// - Returns power optimization capabilities +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pPowerOptimizationCaps` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetPowerOptimizationCaps( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_power_optimization_caps_t* pPowerOptimizationCaps ///< [in,out][release] Query result for power optimization features + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief LRR detailed settings +typedef struct _ctl_power_optimization_lrr_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_power_optimization_lrr_flags_t SupportedLRRTypes; ///< [out] LRR type(s). Refer ::ctl_power_optimization_lrr_flag_t + ctl_power_optimization_lrr_flags_t CurrentLRRTypes; ///< [in,out] Current enabled LRR type(s) or the LRR type(s) to set to. + ///< Refer ::ctl_power_optimization_lrr_flag_t + bool bRequirePSRDisable; ///< [out] Require PSR disable for any change in the selected LRR feature. + ///< Caller can re-enable PSR once the respective LRR feature is + ///< enable/disabled. E.g. for UBRR based on platform this flag may not be + ///< set in which case caller doesn't need to do an explicit PSR disable + uint16_t LowRR; ///< [out] Lowest RR used for LRR functionality if known to source + +} ctl_power_optimization_lrr_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief PSR detailed settings +typedef struct _ctl_power_optimization_psr_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint8_t PSRVersion; ///< [in,out] A value of 1 means PSR1, 2 means PSR2 + bool FullFetchUpdate; ///< [in,out] Full fetch and update + +} ctl_power_optimization_psr_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief DPST detailed settings +typedef struct _ctl_power_optimization_dpst_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint8_t MinLevel; ///< [out] Minimum supported aggressiveness level + uint8_t MaxLevel; ///< [out] Maximum supported aggressiveness level + uint8_t Level; ///< [in,out] Current aggressiveness level to be set + ctl_power_optimization_dpst_flags_t SupportedFeatures; ///< [out] Supported features + ctl_power_optimization_dpst_flags_t EnabledFeatures;///< [in,out] Features enabled or to be enabled. Fill only one feature for + ///< SET call + +} ctl_power_optimization_dpst_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Feature specific power optimization data +typedef union _ctl_power_optimization_feature_specific_info_t +{ + ctl_power_optimization_lrr_t LRRInfo; ///< [out] LRR info + ctl_power_optimization_psr_t PSRInfo; ///< [in,out] PSR info + ctl_power_optimization_dpst_t DPSTInfo; ///< [in,out] DPST info + +} ctl_power_optimization_feature_specific_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Power optimization settings +typedef struct _ctl_power_optimization_settings_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_power_optimization_plan_t PowerOptimizationPlan;///< [in] Power optimization power plan (max power/max perf/balanced) + ctl_power_optimization_flags_t PowerOptimizationFeature;///< [in] Power optimization feature interested in. Refer + ///< ::ctl_power_optimization_flag_t + bool Enable; ///< [in,out] Enable state + ctl_power_optimization_feature_specific_info_t FeatureSpecificData; ///< [in,out] Data specific to the feature caller is interested in + ctl_power_source_t PowerSource; ///< [in] AC/DC + +} ctl_power_optimization_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Brightness settings for SET call +typedef struct _ctl_set_brightness_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t TargetBrightness; ///< [in] The brightness level that the display need to transitioning to in + ///< milli-percentage. Range is 0-100000 (100%) + uint32_t SmoothTransitionTimeInMs; ///< [in] Transition Time for brightness to take effect in milli-seconds. + ///< If its 0 then it will be an immediate change. Maximum possible value + ///< is 1000ms. + uint32_t ReservedFields[4]; ///< [in] Reserved for future use + +} ctl_set_brightness_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Brightness settings for GET call +typedef struct _ctl_get_brightness_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t TargetBrightness; ///< [out] The brightness level that the display is currently transitioning + ///< to in milli-percentage. If not in a transition, this should equal the + ///< current brightness. Range is 0-100000 (100%) + uint32_t CurrentBrightness; ///< [out] The current brightness level of the display in milli-percentage + uint32_t ReservedFields[4]; ///< [out] Reserved for future use + +} ctl_get_brightness_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Power optimization setting +/// +/// @details +/// - Returns power optimization setting for a specific feature +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pPowerOptimizationSettings` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG - "Unsupported PowerOptimizationFeature" +/// - ::CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST - "DPST is supported only in DC Mode" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetPowerOptimizationSetting( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_power_optimization_settings_t* pPowerOptimizationSettings ///< [in,out][release] Power optimization data to be fetched + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set Power optimization setting +/// +/// @details +/// - Set power optimization setting for a specific feature +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pPowerOptimizationSettings` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG - "Unsupported PowerOptimizationFeature" +/// - ::CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST - "DPST is supported only in DC Mode" +/// - ::CTL_RESULT_ERROR_SET_FBC_FEATURE_NOT_SUPPORTED - "Set FBC Feature not supported" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlSetPowerOptimizationSetting( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_power_optimization_settings_t* pPowerOptimizationSettings ///< [in][release] Power optimization data to be applied + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set Brightness on companion display +/// +/// @details +/// - Set Brightness for a target display. Currently support is only for +/// companion display. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSetBrightnessSetting` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid Brightness data passed as argument" +/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Currently Brightness API is supported only on companion display" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlSetBrightnessSetting( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_set_brightness_t* pSetBrightnessSetting ///< [in][release] Brightness settings to be applied + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Brightness setting +/// +/// @details +/// - Get Brightness for a target display. Currently support is only for +/// companion display. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pGetBrightnessSetting` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Currently Brightness API is supported only on companion display" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetBrightnessSetting( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_get_brightness_t* pGetBrightnessSetting ///< [out][release] Brightness settings data to be fetched + ); + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAX_NUM_SAMPLES_PER_CHANNEL_1D_LUT +/// @brief Maximum number of samples per channel 1D LUT +#define CTL_MAX_NUM_SAMPLES_PER_CHANNEL_1D_LUT 8192 +#endif // CTL_MAX_NUM_SAMPLES_PER_CHANNEL_1D_LUT + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixtx pipe set configuration flags bitmasks +typedef uint32_t ctl_pixtx_pipe_set_config_flags_t; +typedef enum _ctl_pixtx_pipe_set_config_flag_t +{ + CTL_PIXTX_PIPE_SET_CONFIG_FLAG_PERSIST_ACROSS_POWER_EVENTS = CTL_BIT(0),///< For maintaining persistance across power events + CTL_PIXTX_PIPE_SET_CONFIG_FLAG_MAX = 0x80000000 + +} ctl_pixtx_pipe_set_config_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation block types +typedef enum _ctl_pixtx_block_type_t +{ + CTL_PIXTX_BLOCK_TYPE_1D_LUT = 1, ///< Block type 1D LUT + CTL_PIXTX_BLOCK_TYPE_3D_LUT = 2, ///< Block type 3D LUT + CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX = 3, ///< Block type 3x3 matrix + CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX_AND_OFFSETS = 4,///< Block type 3x3 matrix and offsets + CTL_PIXTX_BLOCK_TYPE_MAX + +} ctl_pixtx_block_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation LUT sampling types +typedef enum _ctl_pixtx_lut_sampling_type_t +{ + CTL_PIXTX_LUT_SAMPLING_TYPE_UNIFORM = 0, ///< Uniform LUT sampling + CTL_PIXTX_LUT_SAMPLING_TYPE_NONUNIFORM = 1, ///< Non uniform LUT sampling, Required mainly in HDR mode + CTL_PIXTX_LUT_SAMPLING_TYPE_MAX + +} ctl_pixtx_lut_sampling_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Configuration query types +typedef enum _ctl_pixtx_config_query_type_t +{ + CTL_PIXTX_CONFIG_QUERY_TYPE_CAPABILITY = 0, ///< Get complete pixel processing pipeline capability + CTL_PIXTX_CONFIG_QUERY_TYPE_CURRENT = 1, ///< Get the configuration set through last set call + CTL_PIXTX_CONFIG_QUERY_TYPE_MAX + +} ctl_pixtx_config_query_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Configuration operation types +typedef enum _ctl_pixtx_config_opertaion_type_t +{ + CTL_PIXTX_CONFIG_OPERTAION_TYPE_RESTORE_DEFAULT = 1,///< Restore block by block or entire pipe line. Use NumBlocks = 0 to + ///< restore all. + CTL_PIXTX_CONFIG_OPERTAION_TYPE_SET_CUSTOM = 2, ///< Custom LUT or matrix can be set thorugh this option. + CTL_PIXTX_CONFIG_OPERTAION_TYPE_MAX + +} ctl_pixtx_config_opertaion_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation gamma encoding types +typedef enum _ctl_pixtx_gamma_encoding_type_t +{ + CTL_PIXTX_GAMMA_ENCODING_TYPE_SRGB = 0, ///< Gamma encoding SRGB + CTL_PIXTX_GAMMA_ENCODING_TYPE_REC709 = 1, ///< Gamma encoding REC709, Applicable for REC2020 as well + CTL_PIXTX_GAMMA_ENCODING_TYPE_ST2084 = 2, ///< Gamma encoding ST2084 + CTL_PIXTX_GAMMA_ENCODING_TYPE_HLG = 3, ///< Gamma encoding HLG + CTL_PIXTX_GAMMA_ENCODING_TYPE_LINEAR = 4, ///< Gamma encoding linear + CTL_PIXTX_GAMMA_ENCODING_TYPE_MAX + +} ctl_pixtx_gamma_encoding_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation color space types +typedef enum _ctl_pixtx_color_space_t +{ + CTL_PIXTX_COLOR_SPACE_REC709 = 0, ///< Color space REC709 + CTL_PIXTX_COLOR_SPACE_REC2020 = 1, ///< Color space REC2020 + CTL_PIXTX_COLOR_SPACE_ADOBE_RGB = 2, ///< Color space AdobeRGB + CTL_PIXTX_COLOR_SPACE_P3_D65 = 3, ///< Color space P3_D65 + CTL_PIXTX_COLOR_SPACE_P3_DCI = 4, ///< Color space P3_DCI + CTL_PIXTX_COLOR_SPACE_P3_D60 = 5, ///< Color space P3_D60 + CTL_PIXTX_COLOR_SPACE_CUSTOM = 0xFFFF, ///< Color space custom, Refer ::ctl_pixtx_color_primaries_t for color + ///< primary details + CTL_PIXTX_COLOR_SPACE_MAX + +} ctl_pixtx_color_space_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation color model types +typedef enum _ctl_pixtx_color_model_t +{ + CTL_PIXTX_COLOR_MODEL_RGB_FR = 0, ///< Color model RGB full range + CTL_PIXTX_COLOR_MODEL_RGB_LR = 1, ///< Color model RGB limited range + CTL_PIXTX_COLOR_MODEL_YCBCR_422_FR = 2, ///< Color model YCBCR 422 full range + CTL_PIXTX_COLOR_MODEL_YCBCR_422_LR = 3, ///< Color model YCBCR 422 limited range + CTL_PIXTX_COLOR_MODEL_YCBCR_420_FR = 4, ///< Color model YCBCR 420 full range + CTL_PIXTX_COLOR_MODEL_YCBCR_420_LR = 5, ///< Color model YCBCR 420 limited range + CTL_PIXTX_COLOR_MODEL_YCBCR_444_FR = 6, ///< Color model YCBCR 444 full range + CTL_PIXTX_COLOR_MODEL_YCBCR_444_LR = 7, ///< Color model YCBCR 444 limited range + CTL_PIXTX_COLOR_MODEL_MAX + +} ctl_pixtx_color_model_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation color primaries +typedef struct _ctl_pixtx_color_primaries_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + double xR; ///< [out] CIE1931 x value with maximum red pixel value + double yR; ///< [out] CIE1931 y value with maximum red pixel value + double xG; ///< [out] CIE1931 x value with maximum green pixel value + double yG; ///< [out] CIE1931 y value with maximum green pixel value + double xB; ///< [out] CIE1931 x value with maximum blue pixel value + double yB; ///< [out] CIE1931 y value with maximum blue pixel value + double xW; ///< [out] CIE1931 x value with maximum white pixel value + double yW; ///< [out] CIE1931 y value with maximum white pixel value + +} ctl_pixtx_color_primaries_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation pixel format +typedef struct _ctl_pixtx_pixel_format_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t BitsPerColor; ///< [out] Bits per color, It Will be 16 for FP16 case + bool IsFloat; ///< [out] Will be set for FP16 or other floating point encoding schemes + ctl_pixtx_gamma_encoding_type_t EncodingType; ///< [out] Encoding type + ctl_pixtx_color_space_t ColorSpace; ///< [out] Color space + ctl_pixtx_color_model_t ColorModel; ///< [out] Color model + ctl_pixtx_color_primaries_t ColorPrimaries; ///< [out] Color primaries, Used mainly for custom color space + double MaxBrightness; ///< [out] Maximum brightness of pixel values. If no input is given, + ///< default will be set to sRGB during set call. If panel capability is + ///< not known get call will default to sRGB. + double MinBrightness; ///< [out] Minimum brightness of pixel values + +} ctl_pixtx_pixel_format_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation 1D LUT configuration +typedef struct _ctl_pixtx_1dlut_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_pixtx_lut_sampling_type_t SamplingType; ///< [in,out] Blocks with non-uniform sampling capability support unifrom + ///< sampling also but not vice versa. + uint32_t NumSamplesPerChannel; ///< [in,out] Number of samples per channel. Resampled internally based on + ///< HW capability for uniformly sampled LUT.Maximum supported value is + ///< ::CTL_MAX_NUM_SAMPLES_PER_CHANNEL_1D_LUT Caller needs to use exact + ///< sampling position given in pSamplePositions for non-uniformly sampled + ///< LUTs. + uint32_t NumChannels; ///< [in,out] Number of channels, 1 for Grey scale LUT, 3 for RGB LUT + double* pSampleValues; ///< [in,out] Pointer to sample values, R array followed by G and B arrays + ///< in case of multi-channel LUT. Allocation size for pSampleValues should + ///< be NumSamplesPerChannel * NumChannels * sizeof(double) + double* pSamplePositions; ///< [out] LUT (same for all channels) to represent sampling positions for + ///< non-uniformly sampled LUTs.Can be NULL in case uniformly sampled LUTs + +} ctl_pixtx_1dlut_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation matrix configuration +typedef struct _ctl_pixtx_matrix_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + double PreOffsets[3]; ///< [in,out] Pre offsets + double PostOffsets[3]; ///< [in,out] Post offsets + double Matrix[3][3]; ///< [in,out] 3x3 Matrix + +} ctl_pixtx_matrix_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation 3D LUT sample. Samples are converted to integer +/// based on underlying HW capabilities. Hence slight precision loss will +/// be observed while getting sample values. +typedef struct _ctl_pixtx_3dlut_sample_t +{ + double Red; ///< [in,out] Red output value + double Green; ///< [in,out] Green output value + double Blue; ///< [in,out] Blue output value + +} ctl_pixtx_3dlut_sample_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation 3D LUT configuration +typedef struct _ctl_pixtx_3dlut_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t NumSamplesPerChannel; ///< [in,out] Number of samples per channel + ctl_pixtx_3dlut_sample_t* pSampleValues; ///< [in,out] Pointer to sample values, R in outer most loop followed by G + ///< and B + +} ctl_pixtx_3dlut_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation configuration +typedef union _ctl_pixtx_config_t +{ + ctl_pixtx_1dlut_config_t OneDLutConfig; ///< [in,out] 1D LUT configuration + ctl_pixtx_3dlut_config_t ThreeDLutConfig; ///< [in,out] 3D LUT configuration + ctl_pixtx_matrix_config_t MatrixConfig; ///< [in,out] Matrix configuration + +} ctl_pixtx_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation block configuration +typedef struct _ctl_pixtx_block_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t BlockId; ///< [in,out] Unique ID for each pixel processing block. Id for a block is + ///< fixed for a platform. + ctl_pixtx_block_type_t BlockType; ///< [in,out] Block type + ctl_pixtx_config_t Config; ///< [in,out] Configuration + +} ctl_pixtx_block_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation pipe get configuration +typedef struct _ctl_pixtx_pipe_get_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_pixtx_config_query_type_t QueryType; ///< [in] Query operation type + ctl_pixtx_pixel_format_t InputPixelFormat; ///< [out] Input pixel format + ctl_pixtx_pixel_format_t OutputPixelFormat; ///< [out] Output pixel format + uint32_t NumBlocks; ///< [out] Number of blocks + ctl_pixtx_block_config_t* pBlockConfigs; ///< [out] Pointer to specific configs + +} ctl_pixtx_pipe_get_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation pipe set configuration +typedef struct _ctl_pixtx_pipe_set_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_pixtx_config_opertaion_type_t OpertaionType;///< [in] Set operation type + ctl_pixtx_pipe_set_config_flags_t Flags; ///< [in] Config flags. Refer ::ctl_pixtx_pipe_set_config_flag_t + uint32_t NumBlocks; ///< [in] Number of blocks + ctl_pixtx_block_config_t* pBlockConfigs; ///< [in,out] Array of block specific configs + +} ctl_pixtx_pipe_set_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation get pipe configuration +/// +/// @details +/// - The application does pixel transformation get pipe configuration +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pPixTxGetConfigArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +/// - ::CTL_RESULT_ERROR_INVALID_PIXTX_GET_CONFIG_QUERY_TYPE - "Invalid query type" +/// - ::CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID - "Invalid block id" +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PIXTX_BLOCK_CONFIG_MEMORY - "Insufficient memery allocated for BlockConfigs" +/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_PIPE - "Invalid pipe for 3dlut" +/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_DATA - "Invalid 3dlut data" +/// - ::CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR - "3dlut not supported in HDR" +/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION - "Invalid 3dlut operation" +/// - ::CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL - "3dlut call unsuccessful" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPixelTransformationGetConfig( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_pixtx_pipe_get_config_t* pPixTxGetConfigArgs///< [in,out] Pixel transformation get pipe configiguration arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Pixel transformation set pipe configuration +/// +/// @details +/// - The application does pixel transformation set pipe configuration +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pPixTxSetConfigArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +/// - ::CTL_RESULT_ERROR_INVALID_PIXTX_SET_CONFIG_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INVALID_SET_CONFIG_NUMBER_OF_SAMPLES - "Invalid number of samples" +/// - ::CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID - "Invalid block id" +/// - ::CTL_RESULT_ERROR_PERSISTANCE_NOT_SUPPORTED - "Persistance not supported" +/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_PIPE - "Invalid pipe for 3dlut" +/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_DATA - "Invalid 3dlut data" +/// - ::CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR - "3dlut not supported in HDR" +/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION - "Invalid 3dlut operation" +/// - ::CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL - "3dlut call unsuccessful" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPixelTransformationSetConfig( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_pixtx_pipe_set_config_t* pPixTxSetConfigArgs///< [in,out] Pixel transformation set pipe configiguration arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Panel descriptor access arguments +typedef struct _ctl_panel_descriptor_access_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_operation_type_t OpType; ///< [in] Operation type, 1 for Read, 2 for Write. App needs to run with + ///< admin privileges for Write operation, Currently only Read operation is + ///< supported + uint32_t BlockNumber; ///< [in] Block number, Need to provide only if acccessing EDID + uint32_t DescriptorDataSize; ///< [in] Descriptor data size, Should be 0 for querying the size and + ///< should be DescriptorDataSize derived from query call otherwise + uint8_t* pDescriptorData; ///< [in,out] Panel descriptor data + +} ctl_panel_descriptor_access_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Panel Descriptor Access +/// +/// @details +/// - The application does EDID or Display ID access +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pPanelDescriptorAccessArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPanelDescriptorAccess( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_panel_descriptor_access_args_t* pPanelDescriptorAccessArgs ///< [in,out] Panel descriptor access arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retro Scaling Types +typedef uint32_t ctl_retro_scaling_type_flags_t; +typedef enum _ctl_retro_scaling_type_flag_t +{ + CTL_RETRO_SCALING_TYPE_FLAG_INTEGER = CTL_BIT(0), ///< Integer Scaling + CTL_RETRO_SCALING_TYPE_FLAG_NEAREST_NEIGHBOUR = CTL_BIT(1), ///< Nearest Neighbour Scaling + CTL_RETRO_SCALING_TYPE_FLAG_MAX = 0x80000000 + +} ctl_retro_scaling_type_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set/Get Retro Scaling Type +typedef struct _ctl_retro_scaling_settings_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool Get; ///< [in][release] Set to true to get current scaling . Set to False to Set + ///< the scaling + bool Enable; ///< [in,out] State of the scaler + ctl_retro_scaling_type_flags_t RetroScalingType;///< [out] Requested retro scaling types. Refer + ///< ::ctl_retro_scaling_type_flag_t + +} ctl_retro_scaling_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Retro Scaling caps +typedef struct _ctl_retro_scaling_caps_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_retro_scaling_type_flags_t SupportedRetroScaling; ///< [out] Supported retro scaling types + +} ctl_retro_scaling_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Supported Retro Scaling Types +/// +/// @details +/// - Returns supported retro scaling capabilities +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pRetroScalingCaps` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSupportedRetroScalingCapability( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter + ctl_retro_scaling_caps_t* pRetroScalingCaps ///< [in,out][release] Query result for supported retro scaling types + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Retro Scaling +/// +/// @details +/// - Get or Set the status of retro scaling.This Api will do a physical +/// modeset resulting in flash on the screen +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pGetSetRetroScalingType` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetRetroScaling( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter + ctl_retro_scaling_settings_t* pGetSetRetroScalingType ///< [in,out][release] Get or Set the retro scaling type + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Scaling Types +typedef uint32_t ctl_scaling_type_flags_t; +typedef enum _ctl_scaling_type_flag_t +{ + CTL_SCALING_TYPE_FLAG_IDENTITY = CTL_BIT(0), ///< No scaling is applied and display manages scaling itself when possible + CTL_SCALING_TYPE_FLAG_CENTERED = CTL_BIT(1), ///< Source is not scaled but place in the center of the target display + CTL_SCALING_TYPE_FLAG_STRETCHED = CTL_BIT(2), ///< Source is stretched to fit the target size + CTL_SCALING_TYPE_FLAG_ASPECT_RATIO_CENTERED_MAX = CTL_BIT(3), ///< The aspect ratio is maintained with the source centered + CTL_SCALING_TYPE_FLAG_CUSTOM = CTL_BIT(4), ///< None of the standard types match this .Additional parameters are + ///< required which should be set via a private driver interface + CTL_SCALING_TYPE_FLAG_MAX = 0x80000000 + +} ctl_scaling_type_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Scaling caps +typedef struct _ctl_scaling_caps_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_scaling_type_flags_t SupportedScaling; ///< [out] Supported scaling types. Refer ::ctl_scaling_type_flag_t + +} ctl_scaling_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set/Get Scaling type +typedef struct _ctl_scaling_settings_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool Enable; ///< [in,out] State of the scaler + ctl_scaling_type_flags_t ScalingType; ///< [in,out] Requested scaling types. Refer ::ctl_scaling_type_flag_t + uint32_t CustomScalingX; ///< [in,out] Custom Scaling X resolution + uint32_t CustomScalingY; ///< [in,out] Custom Scaling Y resolution + bool HardwareModeSet; ///< [in] Flag to indicate hardware modeset should be done to apply the + ///< scaling.Setting this to true would result in a flash on the screen. If + ///< this flag is set to false , API will request the OS to do a virtual + ///< modeset , but the OS can ignore this request and do a hardware modeset + ///< in some instances + +} ctl_scaling_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Supported Scaling Types +/// +/// @details +/// - Returns supported scaling capabilities +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pScalingCaps` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSupportedScalingCapability( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_scaling_caps_t* pScalingCaps ///< [in,out][release] Query result for supported scaling types + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Current Scaling +/// +/// @details +/// - Returns current active scaling +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pGetCurrentScalingType` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetCurrentScaling( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_scaling_settings_t* pGetCurrentScalingType ///< [in,out][release] Query result for active scaling types + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set Scaling Type +/// +/// @details +/// - Returns current active scaling +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSetScalingType` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlSetCurrentScaling( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_scaling_settings_t* pSetScalingType ///< [in,out][release] Set scaling types + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ambient light based enhancement table entry +typedef struct _ctl_lace_lux_aggr_map_entry_t +{ + uint32_t Lux; ///< [in,out] Ambient lux + uint8_t AggressivenessPercent; ///< [in,out] Pixel boost agressiveness + +} ctl_lace_lux_aggr_map_entry_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Ambient light based enhancement table +typedef struct _ctl_lace_lux_aggr_map_t +{ + uint32_t MaxNumEntries; ///< [out] Max Number of entries in mapping table supported + uint32_t NumEntries; ///< [in,out] Number of entries in the given mapping table + ctl_lace_lux_aggr_map_entry_t* pLuxToAggrMappingTable; ///< [in] Max number of Entries which can be passed in + ///< LuxToAggrMappingTable + +} ctl_lace_lux_aggr_map_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Data specific to the mode caller is interested in +typedef union _ctl_lace_aggr_config_t +{ + uint8_t FixedAggressivenessLevelPercent; ///< [in,out] Fixed aggressiveness level, applicable for + ///< CTL_LACE_MODE_FIXED_AGGR_LEVEL + ctl_lace_lux_aggr_map_t AggrLevelMap; ///< [in,out] Lux to enhancement mapping table, applicable for + ///< CTL_LACE_MODE_AMBIENT_ADAPTIVE + +} ctl_lace_aggr_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Operations used for additional settings +typedef uint32_t ctl_get_operation_flags_t; +typedef enum _ctl_get_operation_flag_t +{ + CTL_GET_OPERATION_FLAG_CURRENT = CTL_BIT(0), ///< Get the details set through last set call + CTL_GET_OPERATION_FLAG_DEFAULT = CTL_BIT(1), ///< Get the driver default values + CTL_GET_OPERATION_FLAG_CAPABILITY = CTL_BIT(2), ///< Get capability + CTL_GET_OPERATION_FLAG_MAX = 0x80000000 + +} ctl_get_operation_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set Operations used for additional settings +typedef enum _ctl_set_operation_t +{ + CTL_SET_OPERATION_RESTORE_DEFAULT = 0, ///< Restore default values + CTL_SET_OPERATION_CUSTOM = 1, ///< Set custom values + CTL_SET_OPERATION_MAX + +} ctl_set_operation_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Lace Trigger Modes +typedef uint32_t ctl_lace_trigger_flags_t; +typedef enum _ctl_lace_trigger_flag_t +{ + CTL_LACE_TRIGGER_FLAG_AMBIENT_LIGHT = CTL_BIT(0), ///< LACE enhancement depends on Ambient light + CTL_LACE_TRIGGER_FLAG_FIXED_AGGRESSIVENESS = CTL_BIT(1),///< LACE enhancement is as per given fixed aggressiveness level + CTL_LACE_TRIGGER_FLAG_MAX = 0x80000000 + +} ctl_lace_trigger_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set/Get LACE Config +typedef struct _ctl_lace_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool Enabled; ///< [in,out] Enable or disable LACE feature + ctl_get_operation_flags_t OpTypeGet; ///< [in] Get Operations used for additional settings + ctl_set_operation_t OpTypeSet; ///< [in] Set Operations used for additional settings + ctl_lace_trigger_flags_t Trigger; ///< [in,out] LACE operating mode to be Triggerd + ctl_lace_aggr_config_t LaceConfig; ///< [in,out] Data specific to the mode, caller is interested in + +} ctl_lace_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get LACE Config +/// +/// @details +/// - Returns current LACE Config +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLaceConfig` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED - "Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data passed by user" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetLACEConfig( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_lace_config_t* pLaceConfig ///< [out]Lace configuration + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Sets LACE Config +/// +/// @details +/// - Sets LACE Config +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLaceConfig` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED - "Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data passed by user" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlSetLACEConfig( + ctl_display_output_handle_t hDisplayOutput, ///< [in]Handle to display output + ctl_lace_config_t* pLaceConfig ///< [in]Lace configuration + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Software PSR status/Set Software PSR settings +typedef struct _ctl_sw_psr_settings_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool Set; ///< [in][release] Set to False to Get Software PSR status. Set to True to + ///< Enable/Disable Software PSR + bool Supported; ///< [out] When Get is True, returns if SW PSR is supported + bool Enable; ///< [in,out] When Get is True, returns current state of Software PSR. + ///< When Get is False, Enables/Diasbles Software PSR + +} ctl_sw_psr_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Software PSR caps/Set software PSR State +/// +/// @details +/// - Returns Software PSR status or Sets Software PSR capabilities. This is +/// a reserved capability. By default, software PSR is not supported/will +/// not be enabled, need application to activate it, please contact Intel +/// for activation. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSoftwarePsrSetting` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlSoftwarePSR( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_sw_psr_settings_t* pSoftwarePsrSetting ///< [in,out][release] Get Software PSR caps/state or Set Software PSR + ///< state + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intel Arc Sync Monitor Params +typedef struct _ctl_intel_arc_sync_monitor_params_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool IsIntelArcSyncSupported; ///< [out] Intel Arc Sync support for the monitor + float MinimumRefreshRateInHz; ///< [out] Minimum Intel Arc Sync refresh rate supported by the monitor + float MaximumRefreshRateInHz; ///< [out] Maximum Intel Arc Sync refresh rate supported by the monitor + uint32_t MaxFrameTimeIncreaseInUs; ///< [out] Max frame time increase in micro seconds from DID2.1 Adaptive + ///< Sync block + uint32_t MaxFrameTimeDecreaseInUs; ///< [out] Max frame time decrease in micro seconds from DID2.1 Adaptive + ///< Sync block + +} ctl_intel_arc_sync_monitor_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Intel Arc Sync information for monitor +/// +/// @details +/// - Returns Intel Arc Sync information for selected monitor +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pIntelArcSyncMonitorParams` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetIntelArcSyncInfoForMonitor( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_intel_arc_sync_monitor_params_t* pIntelArcSyncMonitorParams ///< [in,out][release] Intel Arc Sync params for monitor + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle of a MUX output instance +typedef struct _ctl_mux_output_handle_t *ctl_mux_output_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enumerate Display MUX Devices on this system across adapters +/// +/// @details +/// - The application enumerates all MUX devices in the system +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hAPIHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +/// + `nullptr == phMuxDevices` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumerateMuxDevices( + ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned + ///< by the CtlInit function + uint32_t* pCount, ///< [in,out][release] pointer to the number of MUX device instances. If + ///< input count is zero, then the api will update the value with the total + ///< number of MUX devices available and return the Count value. If input + ///< count is non-zero, then the api will only retrieve the number of MUX Devices. + ///< If count is larger than the number of MUX devices available, then the + ///< api will update the value with the correct number of MUX devices available. + ctl_mux_output_handle_t* phMuxDevices ///< [out][range(0, *pCount)] array of MUX device instance handles + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Display MUX device properties +typedef struct _ctl_mux_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint8_t MuxId; ///< [out] MUX ID of this MUX device enumerated + uint32_t Count; ///< [in,out] Pointer to the number of display output instances this MUX + ///< object can drive. If count is zero, then the api will update the value + ///< with the total + ///< number of outputs available. If count is non-zero, then the api will + ///< only retrieve the number of outputs. + ///< If count is larger than the number of display outputs MUX can drive, + ///< then the api will update the value with the correct number of display + ///< outputs MUX can driver. + ctl_display_output_handle_t* phDisplayOutputs; ///< [in,out][range(0, *pCount)] Array of display output instance handles + ///< this MUX device can drive + uint8_t IndexOfDisplayOutputOwningMux; ///< [out] [range(0, (Count-1))] This is the index into the + ///< phDisplayOutputs list to the display output which currently owns the + ///< MUX output. This doesn't mean display is active + +} ctl_mux_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Display Mux properties +/// +/// @details +/// - Get the propeties of the Mux device +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hMuxDevice` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pMuxProperties` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetMuxProperties( + ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle + ctl_mux_properties_t* pMuxProperties ///< [in,out] MUX device properties + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Switch Mux output +/// +/// @details +/// - Switches the MUX output +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hMuxDevice` +/// + `nullptr == hInactiveDisplayOutput` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlSwitchMux( + ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle + ctl_display_output_handle_t hInactiveDisplayOutput ///< [out] Input selection for this MUX, which if active will drive the + ///< output of this MUX device. This should be one of the display output + ///< handles reported under this MUX device's properties. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intel Arc Sync profile +typedef enum _ctl_intel_arc_sync_profile_t +{ + CTL_INTEL_ARC_SYNC_PROFILE_INVALID = 0, ///< Invalid profile + CTL_INTEL_ARC_SYNC_PROFILE_RECOMMENDED = 1, ///< Default. Selects appropriate profile based on the monitor. COMPATIBLE + ///< profile is applied if profile is not available for the monitor + CTL_INTEL_ARC_SYNC_PROFILE_EXCELLENT = 2, ///< Unconstrained. Full VRR range of the monitor can be used + CTL_INTEL_ARC_SYNC_PROFILE_GOOD = 3, ///< Some minor range constraints, unlikely to effect user experience but + ///< can reduce flicker on some monitors + CTL_INTEL_ARC_SYNC_PROFILE_COMPATIBLE = 4, ///< Significant constraints that will reduce flicker considerably but are + ///< likely to cause some level of judder onscreen especially when refresh + ///< rates are changing rapidly + CTL_INTEL_ARC_SYNC_PROFILE_OFF = 5, ///< Disable Intel Arc Sync on this monitor. This disables variable rate + ///< flips on this monitor. All sync flips will occur at the OS requested + ///< refresh rate + CTL_INTEL_ARC_SYNC_PROFILE_VESA = 6, ///< Applies vesa specified constraints if the monitor has provided them, + ///< COMPATIBLE profile if not + CTL_INTEL_ARC_SYNC_PROFILE_CUSTOM = 7, ///< Unlocks controls to set a custom Intel Arc Sync profile + CTL_INTEL_ARC_SYNC_PROFILE_MAX + +} ctl_intel_arc_sync_profile_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intel Arc Sync Profile Params +typedef struct _ctl_intel_arc_sync_profile_params_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_intel_arc_sync_profile_t IntelArcSyncProfile; ///< [in,out] Intel Arc Sync profile used by driver. Refer + ///< ::ctl_intel_arc_sync_profile_t + float MaxRefreshRateInHz; ///< [in,out] Maximum refresh rate utilized by the driver + float MinRefreshRateInHz; ///< [in,out] Minimum refresh rate utilized by the driver + uint32_t MaxFrameTimeIncreaseInUs; ///< [in,out] Maximum frame time increase (in micro seconds) imposed by the + ///< driver + uint32_t MaxFrameTimeDecreaseInUs; ///< [in,out] Maximum frame time decrease (in micro seconds) imposed by the + ///< driver + +} ctl_intel_arc_sync_profile_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Intel Arc Sync profile +/// +/// @details +/// - Returns Intel Arc Sync profile for selected monitor +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pIntelArcSyncProfileParams` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetIntelArcSyncProfile( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_intel_arc_sync_profile_params_t* pIntelArcSyncProfileParams ///< [in,out][release] Intel Arc Sync params for monitor + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set Intel Arc Sync profile +/// +/// @details +/// - Sets Intel Arc Sync profile for selected monitor. In a mux situation, +/// this API should be called for all display IDs associated with a +/// physical display. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pIntelArcSyncProfileParams` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlSetIntelArcSyncProfile( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_intel_arc_sync_profile_params_t* pIntelArcSyncProfileParams ///< [in][release] Intel Arc Sync params for monitor + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief EDID Management operation type +typedef enum _ctl_edid_management_optype_t +{ + CTL_EDID_MANAGEMENT_OPTYPE_READ_EDID = 1, ///< This operation type is to read an output's EDID. Set edid_type input + ///< arg to read MONITOR EDID or previously OVERRIDDEN EDID or CURRENT + ///< active EDID. Read EDID is a 2 pass call. First call with size = 0, + ///< pEdidBuf = nullptr to get the size, then call with allocated buffer to + ///< get the EDID data. READ operation is applicable for any normal, edid + ///< locked or edid overridden display output device. + CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID = 2, ///< To make an output always connected with OVERRIDE or MONITOR EDID + ///< across reboots. When output isn't connected call with OVERRIDE EDID; + ///< when connected, either set OVERRIDE and provide pEdidBuf or set + ///< MONITOR and driver will use monitor's EDID. There is no change to EDID + ///< stored in Monitor. Cannot be called when override is active. Any OS + ///< EDID override will take precedence over IGCL override. + CTL_EDID_MANAGEMENT_OPTYPE_UNLOCK_EDID = 3, ///< To undo lock EDID operation, i.e. it makes output as detached in + ///< response to unplug. This operation removes past supplied EDID; output + ///< status is reported to OS as it is; output restores back to monitor's + ///< EDID when it is connected + CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID = 4, ///< To replace an output's EDID with supplied one (pEdidBuf) only when + ///< physical display is connected. There is no change to EDID stored in + ///< Monitor. Cannot apply this operation on locked output. When no output + ///< device attached, the supplied EDID will be persisted in driver for + ///< future use. Any OS EDID override will take precedence over IGCL + ///< override. + CTL_EDID_MANAGEMENT_OPTYPE_UNDO_OVERRIDE_EDID = 5, ///< To undo override EDID operation, that is remove previously overridden + ///< EDID on an output. Output restores back to monitor's EDID when it is + ///< connected + CTL_EDID_MANAGEMENT_OPTYPE_MAX + +} ctl_edid_management_optype_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief EDID type. Used in LOCK_EDID and READ_EDID calls. +typedef enum _ctl_edid_type_t +{ + CTL_EDID_TYPE_CURRENT = 1, ///< [in] Used to return currently active EDID in READ_EDID call. + CTL_EDID_TYPE_OVERRIDE = 2, ///< [in] Is it user supplied EDID. Used in LOCK_EDID call with Supplied + ///< EDID or in READ_EDID to get Supplied EDID. + CTL_EDID_TYPE_MONITOR = 3, ///< [in] Is it Monitor's EDID. Used in LOCK_EDID and READ_EDID calls. + CTL_EDID_TYPE_MAX + +} ctl_edid_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Edid management operation Out Flags +typedef uint32_t ctl_edid_management_out_flags_t; +typedef enum _ctl_edid_management_out_flag_t +{ + CTL_EDID_MANAGEMENT_OUT_FLAG_OS_CONN_NOTIFICATION = CTL_BIT(0), ///< [out] If OS was notified about a connection change. App will need to + ///< wait for the OS action to complete. + CTL_EDID_MANAGEMENT_OUT_FLAG_SUPPLIED_EDID = CTL_BIT(1),///< [out] Is it previously supplied EDID, set for READ_EDID(CURRENT). + CTL_EDID_MANAGEMENT_OUT_FLAG_MONITOR_EDID = CTL_BIT(2), ///< [out] Is it Monitor's EDID, set for READ_EDID(CURRENT). + CTL_EDID_MANAGEMENT_OUT_FLAG_DISPLAY_CONNECTED = CTL_BIT(3),///< [out] Is Monitor physically connected + CTL_EDID_MANAGEMENT_OUT_FLAG_MAX = 0x80000000 + +} ctl_edid_management_out_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief EDID management +typedef struct _ctl_edid_management_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_edid_management_optype_t OpType; ///< [in] EDID managmeent operation type + ctl_edid_type_t EdidType; ///< [in] EDID Type, Monitor or Supplied + uint32_t EdidSize; ///< [in,out] EDID Size, should be 0 for querying the size of EDID, should + ///< be previously returned size to read EDID. if buffer isn't big enough + ///< to fit EDID, returns size of EDID bytes. + uint8_t* pEdidBuf; ///< [in,out] buffer holding EDID data + ctl_edid_management_out_flags_t OutFlags; ///< [out] Output flags to inform about status of EDID management + ///< operations + +} ctl_edid_management_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief EDID Management allows managing an output's EDID or Plugged Status. +/// +/// @details +/// - To manage output's EDID or Display ID. Supports native DP SST and HDMI +/// Display types. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pEdidManagementArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ATTACHED - "Error for Output Device not attached" +/// - ::CTL_RESULT_ERROR_OUT_OF_DEVICE_MEMORY - "Insufficient device memory to satisfy call" +/// - ::CTL_RESULT_ERROR_DATA_NOT_FOUND - "Requested EDID data not present." +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEdidManagement( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_edid_management_args_t* pEdidManagementArgs ///< [in,out] EDID management arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Custom mode operation types +typedef enum _ctl_custom_mode_operation_types_t +{ + CTL_CUSTOM_MODE_OPERATION_TYPES_GET_CUSTOM_SOURCE_MODES = 0,///< Get details of all previous applied custom modes if any. + CTL_CUSTOM_MODE_OPERATION_TYPES_ADD_CUSTOM_SOURCE_MODE = 1, ///< Add a new mode. Allows only single mode adition at a time. + CTL_CUSTOM_MODE_OPERATION_TYPES_REMOVE_CUSTOM_SOURCE_MODES = 2, ///< Remove previously added custom mode. Allows single or multiple mode + ///< removal at a time. + CTL_CUSTOM_MODE_OPERATION_TYPES_MAX + +} ctl_custom_mode_operation_types_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Custom Mode +typedef struct _ctl_get_set_custom_mode_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_custom_mode_operation_types_t CustomModeOpType; ///< [in] Custom mode operation type + uint32_t NumOfModes; ///< [in,out] Number of Custom Src Modes to be added/removed/Read. + ctl_custom_src_mode_t* pCustomSrcModeList; ///< [in,out] Custom mode source list which holds source modes to be + ///< added/removed/Read. + +} ctl_get_set_custom_mode_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Custom Mode +typedef struct _ctl_custom_src_mode_t +{ + uint32_t SourceX; ///< [in,out] CustomMode Source X Size + uint32_t SourceY; ///< [in,out] CustomMode Source Y Size + +} ctl_custom_src_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Custom mode. +/// +/// @details +/// - To get or set custom mode. +/// - Add custom source mode operation supports only single mode additon at +/// a time. +/// - Remove custom source mode operation supports single or multiple mode +/// removal at a time. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCustomModeArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +/// - ::CTL_RESULT_ERROR_CUSTOM_MODE_STANDARD_CUSTOM_MODE_EXISTS - "Standard custom mode exists" +/// - ::CTL_RESULT_ERROR_CUSTOM_MODE_NON_CUSTOM_MATCHING_MODE_EXISTS - "Non custom matching mode exists" +/// - ::CTL_RESULT_ERROR_CUSTOM_MODE_INSUFFICIENT_MEMORY - "Custom mode insufficent memory" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetCustomMode( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_get_set_custom_mode_args_t* pCustomModeArgs ///< [in,out] Custom mode arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Combined Display operation type +typedef enum _ctl_combined_display_optype_t +{ + CTL_COMBINED_DISPLAY_OPTYPE_IS_SUPPORTED_CONFIG = 1,///< To check whether given outputs can form a combined display, no changes + ///< are applied + CTL_COMBINED_DISPLAY_OPTYPE_ENABLE = 2, ///< To setup and enable a combined display + CTL_COMBINED_DISPLAY_OPTYPE_DISABLE = 3, ///< To disable combined display + CTL_COMBINED_DISPLAY_OPTYPE_QUERY_CONFIG = 4, ///< To query combined display configuration + CTL_COMBINED_DISPLAY_OPTYPE_MAX + +} ctl_combined_display_optype_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Combined Display's child display target mode +typedef struct _ctl_child_display_target_mode_t +{ + uint32_t Width; ///< [in,out] Width + uint32_t Height; ///< [in,out] Height + float RefreshRate; ///< [in,out] Refresh Rate + uint32_t ReservedFields[4]; ///< [out] Reserved field of 16 bytes + +} ctl_child_display_target_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Combined Display's child display information +typedef struct _ctl_combined_display_child_info_t +{ + ctl_display_output_handle_t hDisplayOutput; ///< [in,out] Display output handle under combined display configuration + ctl_rect_t FbSrc; ///< [in,out] FrameBuffer source's RECT within Combined Display respective + ctl_rect_t FbPos; ///< [in,out] FrameBuffer target's RECT within output size + ctl_display_orientation_t DisplayOrientation; ///< [in,out] 0/180 Degree Display orientation (rotation) + ctl_child_display_target_mode_t TargetMode; ///< [in,out] Desired target mode (width, height, refresh) + +} ctl_combined_display_child_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Combined Display arguments +typedef struct _ctl_combined_display_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_combined_display_optype_t OpType; ///< [in] Combined display operation type + bool IsSupported; ///< [out] Returns yes/no in response to IS_SUPPORTED_CONFIG command + uint8_t NumOutputs; ///< [in,out] Number of outputs part of desired combined display + ///< configuration + uint32_t CombinedDesktopWidth; ///< [in,out] Width of desired combined display configuration + uint32_t CombinedDesktopHeight; ///< [in,out] Height of desired combined display configuration + ctl_combined_display_child_info_t* pChildInfo; ///< [in,out] List of child display information respective to each output. + ///< Up to 16 displays are supported with up to 4 displays per GPU. + ctl_display_output_handle_t hCombinedDisplayOutput; ///< [in,out] Handle to combined display output + +} ctl_combined_display_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Combined Display +/// +/// @details +/// - To get or set combined display with given Child Targets on a Single +/// GPU or across identical GPUs. Multi-GPU(MGPU) combined display is +/// reserved i.e. it is not public and requires special application GUID. +/// MGPU Combined Display will get activated or deactivated in next boot. +/// MGPU scenario will internally link the associated adapters via Linked +/// Display Adapter Call, with supplied hDeviceAdapter being the LDA +/// Primary. If Genlock and enabled in Driver registry and supported by +/// given Display Config, MGPU Combined Display will enable MGPU Genlock +/// with supplied hDeviceAdapter being the Genlock Primary Adapter and the +/// First Child Display being the Primary Display. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCombinedDisplayArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +/// - ::CTL_RESULT_ERROR_FEATURE_NOT_SUPPORTED - "Combined Display feature is not supported in this platform" +/// - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetCombinedDisplay( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] Handle to control device adapter + ctl_combined_display_args_t* pCombinedDisplayArgs ///< [in,out] Setup and get combined display arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Display Genlock Operations +typedef enum _ctl_genlock_operation_t +{ + CTL_GENLOCK_OPERATION_GET_TIMING_DETAILS = 0, ///< Get details of GENLOCK support and timing information + CTL_GENLOCK_OPERATION_VALIDATE = 1, ///< Driver to verify that the topology is Genlock capable + CTL_GENLOCK_OPERATION_ENABLE = 2, ///< Enable GENLOCK + CTL_GENLOCK_OPERATION_DISABLE = 3, ///< Disable GENLOCK + CTL_GENLOCK_OPERATION_GET_TOPOLOGY = 4, ///< Get details of the current Genlock topology that is applied + CTL_GENLOCK_OPERATION_MAX + +} ctl_genlock_operation_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Display Genlock Info +typedef struct _ctl_genlock_display_info_t +{ + ctl_display_output_handle_t hDisplayOutput; ///< [in,out] Display output handle under Genlock topology + bool IsPrimary; ///< [in,out] Genlock Primary + +} ctl_genlock_display_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Genlock Target Mode List +typedef struct _ctl_genlock_target_mode_list_t +{ + ctl_display_output_handle_t hDisplayOutput; ///< [in] Display output handle for whom target mode list is required + uint32_t NumModes; ///< [in,out] Number of supported Modes that is returned from a driver + ctl_display_timing_t* pTargetModes; ///< [out] Display Genlock operation and information + +} ctl_genlock_target_mode_list_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Genlock Topology +typedef struct _ctl_genlock_topology_t +{ + uint8_t NumGenlockDisplays; ///< [in,out] Number of Genlock displays + bool IsPrimaryGenlockSystem; ///< [in,out] Primary Genlock system + ctl_display_timing_t CommonTargetMode; ///< [in] Common target mode + ctl_genlock_display_info_t* pGenlockDisplayInfo;///< [in,out] List of Genlock display info + ctl_genlock_target_mode_list_t* pGenlockModeList; ///< [out] List of Genlock target modes + +} ctl_genlock_topology_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Display Genlock Arg type +typedef struct _ctl_genlock_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_genlock_operation_t Operation; ///< [in] Display Genlock Operation + ctl_genlock_topology_t GenlockTopology; ///< [in,out] Display Genlock array of topology structures + bool IsGenlockEnabled; ///< [out] Whether the feature is currently enabled or not + bool IsGenlockPossible; ///< [out] Indicates if Genlock can be enabled/disabled with the given + ///< topology + +} ctl_genlock_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Display Genlock +/// +/// @details +/// - To get or set Display Genlock. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == hDeviceAdapter` +/// + `nullptr == pGenlockArgs` +/// + `nullptr == hFailureDeviceAdapter` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid topology structure size" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetDisplayGenlock( + ctl_device_adapter_handle_t* hDeviceAdapter, ///< [in][release] Handle to control device adapter + ctl_genlock_args_t* pGenlockArgs, ///< [in,out] Display Genlock operation and information + uint32_t AdapterCount, ///< [in] Number of device adapters + ctl_device_adapter_handle_t* hFailureDeviceAdapter ///< [out] Handle to address the failure device adapter in an error case + ); + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAX_DISPLAYS_FOR_MGPU_COLLAGE +/// @brief Maximum number of displays for Single Large Screen +#define CTL_MAX_DISPLAYS_FOR_MGPU_COLLAGE 16 +#endif // CTL_MAX_DISPLAYS_FOR_MGPU_COLLAGE + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Vblank timestamp arguments +typedef struct _ctl_vblank_ts_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint8_t NumOfTargets; ///< [out] Number of child targets + uint64_t VblankTS[CTL_MAX_DISPLAYS_FOR_MGPU_COLLAGE]; ///< [out] List of vblank timestamps in microseconds per child target + +} ctl_vblank_ts_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Vblank Timestamp +/// +/// @details +/// - To get a list of vblank timestamps in microseconds for each child +/// target of a display. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pVblankTSArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetVblankTimestamp( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_vblank_ts_args_t* pVblankTSArgs ///< [out] Get vblank timestamp arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Link Display Adapters Arguments +typedef struct _ctl_lda_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint8_t NumAdapters; ///< [in,out] Numbers of adapters to be linked. Up to 4 adapters are + ///< supported + ctl_device_adapter_handle_t* hLinkedAdapters; ///< [in,out][release] List of Control device adapter handles to be linked, + ///< first one being Primary Adapter + uint64_t Reserved[4]; ///< [out] Reserved fields. Set to zero. + +} ctl_lda_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Link Display Adapters +/// +/// @details +/// - To Link Display Adapters. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPrimaryAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLdaArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +/// - ::CTL_RESULT_ERROR_ADAPTER_ALREADY_LINKED - "Adapter is already linked" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlLinkDisplayAdapters( + ctl_device_adapter_handle_t hPrimaryAdapter, ///< [in][release] Handle to Primary adapter in LDA chain + ctl_lda_args_t* pLdaArgs ///< [in] Link Display Adapters Arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Unlink Display Adapters +/// +/// @details +/// - To Unlink Display Adapters +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPrimaryAdapter` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +/// - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlUnlinkDisplayAdapters( + ctl_device_adapter_handle_t hPrimaryAdapter ///< [in][release] Handle to Primary adapter in LDA chain + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Linked Display Adapters +/// +/// @details +/// - To return list of Linked Display Adapters. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPrimaryAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLdaArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +/// - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetLinkedDisplayAdapters( + ctl_device_adapter_handle_t hPrimaryAdapter, ///< [in][release] Handle to Primary adapter in LDA chain + ctl_lda_args_t* pLdaArgs ///< [out] Link Display Adapters Arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Dynamic Contrast Enhancement arguments +typedef struct _ctl_dce_args_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool Set; ///< [in] Flag to indicate Set or Get operation + uint32_t TargetBrightnessPercent; ///< [in] Target brightness percent + double PhaseinSpeedMultiplier; ///< [in] Phase-in speed multiplier for brightness to take effect + uint32_t NumBins; ///< [in,out] Number of histogram bins + bool Enable; ///< [in,out] For get calls, this represents current state & for set this + ///< represents future state + bool IsSupported; ///< [out] is DCE feature supported + uint32_t* pHistogram; ///< [out] Bin wise histogram data of size NumBins * sizeof(uint32_t) for + ///< current frame + +} ctl_dce_args_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Dynamic Contrast Enhancement +/// +/// @details +/// - To get the DCE feature status and, if feature is enabled, returns the +/// current histogram, or to set the brightness at the phase-in speed +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pDceArgs` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetDynamicContrastEnhancement( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_dce_args_t* pDceArgs ///< [in,out] Dynamic Contrast Enhancement arguments + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Color model +typedef enum _ctl_wire_format_color_model_t +{ + CTL_WIRE_FORMAT_COLOR_MODEL_RGB = 0, ///< Color model RGB + CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_420 = 1, ///< Color model YCBCR 420 + CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_422 = 2, ///< Color model YCBCR 422 + CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_444 = 3, ///< Color model YCBCR 444 + CTL_WIRE_FORMAT_COLOR_MODEL_MAX + +} ctl_wire_format_color_model_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Operation type +typedef enum _ctl_wire_format_operation_type_t +{ + CTL_WIRE_FORMAT_OPERATION_TYPE_GET = 0, ///< Get request + CTL_WIRE_FORMAT_OPERATION_TYPE_SET = 1, ///< Set request + CTL_WIRE_FORMAT_OPERATION_TYPE_RESTORE_DEFAULT = 2, ///< Restore to default values + CTL_WIRE_FORMAT_OPERATION_TYPE_MAX + +} ctl_wire_format_operation_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Wire Format +typedef struct _ctl_wire_format_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_wire_format_color_model_t ColorModel; ///< [in,out] Color model + ctl_output_bpc_flags_t ColorDepth; ///< [in,out] Color Depth + +} ctl_wire_format_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED +/// @brief Maximum Wire Formats Supported +#define CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED 4 +#endif // CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Set Wire Format +typedef struct _ctl_get_set_wire_format_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_wire_format_operation_type_t Operation; ///< [in] Get/Set Operation + ctl_wire_format_t SupportedWireFormat[CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED]; ///< [out] Array of WireFormats supported + ctl_wire_format_t WireFormat; ///< [in,out] Current/Requested WireFormat based on Operation. During SET + ///< Operation, if multiple bpc is set, the MIN bpc will be applied + +} ctl_get_set_wire_format_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Color Format and Color Depth +/// +/// @details +/// - Get and Set the Color Format and Color Depth of a target +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pGetSetWireFormatSetting` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid data passed as argument, WireFormat is not supported" +/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetWireFormat( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_get_set_wire_format_config_t* pGetSetWireFormatSetting ///< [in][release] Get/Set Wire Format settings to be fetched/applied + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Various display settings +typedef uint32_t ctl_display_setting_flags_t; +typedef enum _ctl_display_setting_flag_t +{ + CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY = CTL_BIT(0), ///< Low latency + CTL_DISPLAY_SETTING_FLAG_SOURCE_TM = CTL_BIT(1),///< Source tone mapping + CTL_DISPLAY_SETTING_FLAG_CONTENT_TYPE = CTL_BIT(2), ///< Content type + CTL_DISPLAY_SETTING_FLAG_QUANTIZATION_RANGE = CTL_BIT(3), ///< Quantization range, full range or limited range + CTL_DISPLAY_SETTING_FLAG_PICTURE_AR = CTL_BIT(4), ///< Picture aspect ratio + CTL_DISPLAY_SETTING_FLAG_AUDIO = CTL_BIT(5), ///< Audio settings + CTL_DISPLAY_SETTING_FLAG_MAX = 0x80000000 + +} ctl_display_setting_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Low latency setting +typedef enum _ctl_display_setting_low_latency_t +{ + CTL_DISPLAY_SETTING_LOW_LATENCY_DEFAULT = 0, ///< Default + CTL_DISPLAY_SETTING_LOW_LATENCY_DISABLED = 1, ///< Disabled + CTL_DISPLAY_SETTING_LOW_LATENCY_ENABLED = 2, ///< Enabled + CTL_DISPLAY_SETTING_LOW_LATENCY_MAX + +} ctl_display_setting_low_latency_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Source tone mapping setting +typedef enum _ctl_display_setting_sourcetm_t +{ + CTL_DISPLAY_SETTING_SOURCETM_DEFAULT = 0, ///< Default + CTL_DISPLAY_SETTING_SOURCETM_DISABLED = 1, ///< Disabled + CTL_DISPLAY_SETTING_SOURCETM_ENABLED = 2, ///< Enabled + CTL_DISPLAY_SETTING_SOURCETM_MAX + +} ctl_display_setting_sourcetm_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Content type settings +typedef enum _ctl_display_setting_content_type_t +{ + CTL_DISPLAY_SETTING_CONTENT_TYPE_DEFAULT = 0, ///< Default content type used by driver. Driver will use internal + ///< techniques to determine content type and indicate to panel + CTL_DISPLAY_SETTING_CONTENT_TYPE_DISABLED = 1, ///< Content type indication is disabled + CTL_DISPLAY_SETTING_CONTENT_TYPE_DESKTOP = 2, ///< Typical desktop with a mix of text and graphics + CTL_DISPLAY_SETTING_CONTENT_TYPE_MEDIA = 3, ///< Video or media content + CTL_DISPLAY_SETTING_CONTENT_TYPE_GAMING = 4, ///< Gaming content + CTL_DISPLAY_SETTING_CONTENT_TYPE_MAX + +} ctl_display_setting_content_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Quantization range +typedef enum _ctl_display_setting_quantization_range_t +{ + CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_DEFAULT = 0, ///< Default based on video format + CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_LIMITED_RANGE = 1, ///< Limited range + CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_FULL_RANGE = 2, ///< Full range + CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_MAX + +} ctl_display_setting_quantization_range_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Picture aspect ratio +typedef uint32_t ctl_display_setting_picture_ar_flags_t; +typedef enum _ctl_display_setting_picture_ar_flag_t +{ + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DEFAULT = CTL_BIT(0), ///< Default picture aspect ratio + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DISABLED = CTL_BIT(1), ///< Picture aspect ratio indication is explicitly disabled + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_4_3 = CTL_BIT(2),///< Aspect ratio of 4:3 + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_16_9 = CTL_BIT(3), ///< Aspect ratio of 16:9 + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_64_27 = CTL_BIT(4), ///< Aspect ratio of 64:27 or 21:9 anamorphic + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_256_135 = CTL_BIT(5),///< Aspect ratio of 256:135 + CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_MAX = 0x80000000 + +} ctl_display_setting_picture_ar_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Audio settings +typedef enum _ctl_display_setting_audio_t +{ + CTL_DISPLAY_SETTING_AUDIO_DEFAULT = 0, ///< Default audio settings, always enumerated and enabled if display + ///< supports it + CTL_DISPLAY_SETTING_AUDIO_DISABLED = 1, ///< Forcefully disable display audio end point enumeration to OS + CTL_DISPLAY_SETTING_AUDIO_MAX + +} ctl_display_setting_audio_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set end display settings +typedef struct _ctl_display_settings_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool Set; ///< [in] Flag to indicate Set or Get operation. Default option for all + ///< features are reserved for Set=true calls, which will reset the setting + ///< to driver defaults. + ctl_display_setting_flags_t SupportedFlags; ///< [out] Display setting flags supported by the display. + ctl_display_setting_flags_t ControllableFlags; ///< [out] Display setting flags which can be controlled by the caller. + ///< Features which doesn't have this flag set cannot be changed by caller. + ctl_display_setting_flags_t ValidFlags; ///< [in,out] Display setting flags which caller can use to indicate the + ///< features it's interested in. This cannot have a bit set which is not + ///< supported by SupportedFlags and ControllableFlags. + ctl_display_setting_low_latency_t LowLatency; ///< [in,out] Low latency state of panel. For HDR10+ Gaming this need to be + ///< in ENABLED state. + ctl_display_setting_sourcetm_t SourceTM; ///< [in,out] Source tone mapping state known to panel. For HDR10+ Gaming + ///< this need to be in ENABLED state. + ctl_display_setting_content_type_t ContentType; ///< [in,out] Source content type known to panel. + ctl_display_setting_quantization_range_t QuantizationRange; ///< [in,out] Quantization range + ctl_display_setting_picture_ar_flags_t SupportedPictureAR; ///< [out] Supported Picture aspect ratios + ctl_display_setting_picture_ar_flag_t PictureAR;///< [in,out] Picture aspect ratio + ctl_display_setting_audio_t AudioSettings; ///< [in,out] Audio settings + uint32_t Reserved[25]; ///< [out] Reserved fields for future enumerations + +} ctl_display_settings_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Display settings +/// +/// @details +/// - To get/set end display settings like low latency, HDR10+ signaling +/// etc. which are controlled via info-frames/secondary data packets +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDisplayOutput` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pDisplaySettings` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetDisplaySettings( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_display_settings_t* pDisplaySettings ///< [in,out] End display capabilities + ); + + +#if !defined(__GNUC__) +#pragma endregion // display +#endif +// Intel 'ctlApi' for Device Adapter - Engine groups +#if !defined(__GNUC__) +#pragma region engine +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Accelerator engine groups +typedef enum _ctl_engine_group_t +{ + CTL_ENGINE_GROUP_GT = 0, ///< Access information about all engines combined. + CTL_ENGINE_GROUP_RENDER = 1, ///< Access information about all render and compute engines combined. + CTL_ENGINE_GROUP_MEDIA = 2, ///< Access information about all media engines combined. + CTL_ENGINE_GROUP_MAX + +} ctl_engine_group_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Engine group properties +typedef struct _ctl_engine_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_engine_group_t type; ///< [out] The engine group + +} ctl_engine_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Engine activity counters +/// +/// @details +/// - Percent utilization is calculated by taking two snapshots (s1, s2) and +/// using the equation: %util = (s2.activeTime - s1.activeTime) / +/// (s2.timestamp - s1.timestamp) +typedef struct _ctl_engine_stats_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint64_t activeTime; ///< [out] Monotonic counter for time in microseconds that this resource is + ///< actively running workloads. + uint64_t timestamp; ///< [out] Monotonic timestamp counter in microseconds when activeTime + ///< counter was sampled. + ///< This timestamp should only be used to calculate delta time between + ///< snapshots of this structure. + ///< Never take the delta of this timestamp with the timestamp from a + ///< different structure since they are not guaranteed to have the same base. + ///< The absolute value of the timestamp is only valid during within the + ///< application and may be different on the next execution. + +} ctl_engine_stats_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of engine groups +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumEngineGroups( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get engine group properties +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hEngine` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEngineGetProperties( + ctl_engine_handle_t hEngine, ///< [in] Handle for the component. + ctl_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the activity stats for an engine group +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hEngine` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pStats` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEngineGetActivity( + ctl_engine_handle_t hEngine, ///< [in] Handle for the component. + ctl_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity + ///< counters. + ); + + +#if !defined(__GNUC__) +#pragma endregion // engine +#endif +// Intel 'ctlApi' for Device Adapter- Fan management +#if !defined(__GNUC__) +#pragma region fan +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Fan resource speed mode +typedef enum _ctl_fan_speed_mode_t +{ + CTL_FAN_SPEED_MODE_DEFAULT = 0, ///< The fan speed is operating using the hardware default settings + CTL_FAN_SPEED_MODE_FIXED = 1, ///< The fan speed is currently set to a fixed value + CTL_FAN_SPEED_MODE_TABLE = 2, ///< The fan speed is currently controlled dynamically by hardware based on + ///< a temp/speed table + CTL_FAN_SPEED_MODE_MAX + +} ctl_fan_speed_mode_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Fan speed units +typedef enum _ctl_fan_speed_units_t +{ + CTL_FAN_SPEED_UNITS_RPM = 0, ///< The fan speed is in units of revolutions per minute (rpm) + CTL_FAN_SPEED_UNITS_PERCENT = 1, ///< The fan speed is a percentage of the maximum speed of the fan + CTL_FAN_SPEED_UNITS_MAX + +} ctl_fan_speed_units_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Fan speed +typedef struct _ctl_fan_speed_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + int32_t speed; ///< [in,out] The speed of the fan. On output, a value of -1 indicates that + ///< there is no fixed fan speed setting. + ctl_fan_speed_units_t units; ///< [in,out] The units that the fan speed is expressed in. On output, if + ///< fan speed is -1 then units should be ignored. + +} ctl_fan_speed_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Fan temperature/speed pair +typedef struct _ctl_fan_temp_speed_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t temperature; ///< [in,out] Temperature in degrees Celsius. + ctl_fan_speed_t speed; ///< [in,out] The speed of the fan + +} ctl_fan_temp_speed_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_FAN_TEMP_SPEED_PAIR_COUNT +/// @brief Maximum number of fan temperature/speed pairs in the fan speed table. +#define CTL_FAN_TEMP_SPEED_PAIR_COUNT 32 +#endif // CTL_FAN_TEMP_SPEED_PAIR_COUNT + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Fan speed table +typedef struct _ctl_fan_speed_table_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + int32_t numPoints; ///< [in,out] The number of valid points in the fan speed table. 0 means + ///< that there is no fan speed table configured. -1 means that a fan speed + ///< table is not supported by the hardware. + ctl_fan_temp_speed_t table[CTL_FAN_TEMP_SPEED_PAIR_COUNT]; ///< [in,out] Array of temperature/fan speed pairs. The table is ordered + ///< based on temperature from lowest to highest. + +} ctl_fan_speed_table_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Fan properties +typedef struct _ctl_fan_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool canControl; ///< [out] Indicates if software can control the fan speed assuming the + ///< user has permissions + uint32_t supportedModes; ///< [out] Bitfield of supported fan configuration modes + ///< (1<<::ctl_fan_speed_mode_t) + uint32_t supportedUnits; ///< [out] Bitfield of supported fan speed units + ///< (1<<::ctl_fan_speed_units_t) + int32_t maxRPM; ///< [out] The maximum RPM of the fan. A value of -1 means that this + ///< property is unknown. + int32_t maxPoints; ///< [out] The maximum number of points in the fan temp/speed table. A + ///< value of -1 means that this fan doesn't support providing a temp/speed + ///< table. + +} ctl_fan_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Fan configuration +typedef struct _ctl_fan_config_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_fan_speed_mode_t mode; ///< [in,out] The fan speed mode (fixed, temp-speed table) + ctl_fan_speed_t speedFixed; ///< [in,out] The current fixed fan speed setting + ctl_fan_speed_table_t speedTable; ///< [out] A table containing temperature/speed pairs + +} ctl_fan_config_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of fans +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumFans( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to the adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get fan properties +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFan` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFanGetProperties( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + ctl_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get fan configurations and the current fan speed mode (default, fixed, +/// temp-speed table) +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFan` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pConfig` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFanGetConfig( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + ctl_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Configure the fan to run with hardware factory settings (set mode to +/// ::CTL_FAN_SPEED_MODE_DEFAULT) +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFan` +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFanSetDefaultMode( + ctl_fan_handle_t hFan ///< [in] Handle for the component. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Configure the fan to rotate at a fixed speed (set mode to +/// ::CTL_FAN_SPEED_MODE_FIXED) +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFan` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == speed` +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Fixing the fan speed not supported by the hardware or the fan speed units are not supported. See ::ctl_fan_properties_t.supportedModes and ::ctl_fan_properties_t.supportedUnits. +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFanSetFixedSpeedMode( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + const ctl_fan_speed_t* speed ///< [in] The fixed fan speed setting + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Configure the fan to adjust speed based on a temperature/speed table +/// (set mode to ::CTL_FAN_SPEED_MODE_TABLE) +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFan` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == speedTable` +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT +/// + The temperature/speed pairs in the array are not sorted on temperature from lowest to highest. +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + Fan speed table not supported by the hardware or the fan speed units are not supported. See ::ctl_fan_properties_t.supportedModes and ::ctl_fan_properties_t.supportedUnits. +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFanSetSpeedTableMode( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + const ctl_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get current state of a fan - current mode and speed +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFan` +/// - CTL_RESULT_ERROR_INVALID_ENUMERATION +/// + `::CTL_FAN_SPEED_UNITS_PERCENT < units` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSpeed` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE +/// + The requested fan speed units are not supported. See ::ctl_fan_properties_t.supportedUnits. +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFanGetState( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + ctl_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. + int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units + ///< requested. A value of -1 indicates that the fan speed cannot be + ///< measured. + ); + + +#if !defined(__GNUC__) +#pragma endregion // fan +#endif +// Intel 'ctlApi' for Device Adapter - Frequency domains +#if !defined(__GNUC__) +#pragma region frequency +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Frequency domains. +typedef enum _ctl_freq_domain_t +{ + CTL_FREQ_DOMAIN_GPU = 0, ///< GPU Core Domain. + CTL_FREQ_DOMAIN_MEMORY = 1, ///< Local Memory Domain. + CTL_FREQ_DOMAIN_MAX + +} ctl_freq_domain_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Frequency properties +typedef struct _ctl_freq_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_freq_domain_t type; ///< [out] The hardware block that this frequency domain controls (GPU, + ///< memory, ...) + bool canControl; ///< [out] Indicates if software can control the frequency of this domain + ///< assuming the user has permissions + double min; ///< [out] The minimum hardware clock frequency in units of MHz. + double max; ///< [out] The maximum non-overclock hardware clock frequency in units of + ///< MHz. + +} ctl_freq_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Frequency range between which the hardware can operate. The limits can +/// be above or below the hardware limits - the hardware will clamp +/// appropriately. +typedef struct _ctl_freq_range_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + double min; ///< [in,out] The min frequency in MHz below which hardware frequency + ///< management will not request frequencies. On input, setting to 0 will + ///< permit the frequency to go down to the hardware minimum. On output, a + ///< negative value indicates that no external minimum frequency limit is + ///< in effect. + double max; ///< [in,out] The max frequency in MHz above which hardware frequency + ///< management will not request frequencies. On input, setting to 0 or a + ///< very big number will permit the frequency to go all the way up to the + ///< hardware maximum. On output, a negative number indicates that no + ///< external maximum frequency limit is in effect. + +} ctl_freq_range_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Frequency throttle reasons +typedef uint32_t ctl_freq_throttle_reason_flags_t; +typedef enum _ctl_freq_throttle_reason_flag_t +{ + CTL_FREQ_THROTTLE_REASON_FLAG_AVE_PWR_CAP = CTL_BIT(0), ///< frequency throttled due to average power excursion (PL1) + CTL_FREQ_THROTTLE_REASON_FLAG_BURST_PWR_CAP = CTL_BIT(1), ///< frequency throttled due to burst power excursion (PL2) + CTL_FREQ_THROTTLE_REASON_FLAG_CURRENT_LIMIT = CTL_BIT(2), ///< frequency throttled due to current excursion (PL4) + CTL_FREQ_THROTTLE_REASON_FLAG_THERMAL_LIMIT = CTL_BIT(3), ///< frequency throttled due to thermal excursion (T > TjMax) + CTL_FREQ_THROTTLE_REASON_FLAG_PSU_ALERT = CTL_BIT(4), ///< frequency throttled due to power supply assertion + CTL_FREQ_THROTTLE_REASON_FLAG_SW_RANGE = CTL_BIT(5),///< frequency throttled due to software supplied frequency range + CTL_FREQ_THROTTLE_REASON_FLAG_HW_RANGE = CTL_BIT(6),///< frequency throttled due to a sub block that has a lower frequency + ///< range when it receives clocks + CTL_FREQ_THROTTLE_REASON_FLAG_MAX = 0x80000000 + +} ctl_freq_throttle_reason_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Frequency state +typedef struct _ctl_freq_state_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + double currentVoltage; ///< [out] Current voltage in Volts. A negative value indicates that this + ///< property is not known. + double request; ///< [out] The current frequency request in MHz. A negative value indicates + ///< that this property is not known. + double tdp; ///< [out] The maximum frequency in MHz supported under the current TDP + ///< conditions. This fluctuates dynamically based on the power and thermal + ///< limits of the part. A negative value indicates that this property is + ///< not known. + double efficient; ///< [out] The efficient minimum frequency in MHz. A negative value + ///< indicates that this property is not known. + double actual; ///< [out] The resolved frequency in MHz. A negative value indicates that + ///< this property is not known. + ctl_freq_throttle_reason_flags_t throttleReasons; ///< [out] The reasons that the frequency is being limited by the hardware. + ///< Returns 0 (frequency not throttled) or a combination of ::ctl_freq_throttle_reason_flag_t. + +} ctl_freq_state_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Frequency throttle time snapshot +/// +/// @details +/// - Percent time throttled is calculated by taking two snapshots (s1, s2) +/// and using the equation: %throttled = (s2.throttleTime - +/// s1.throttleTime) / (s2.timestamp - s1.timestamp) +typedef struct _ctl_freq_throttle_time_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint64_t throttleTime; ///< [out] The monotonic counter of time in microseconds that the frequency + ///< has been limited by the hardware. + uint64_t timestamp; ///< [out] Microsecond timestamp when throttleTime was captured. + ///< This timestamp should only be used to calculate delta time between + ///< snapshots of this structure. + ///< Never take the delta of this timestamp with the timestamp from a + ///< different structure since they are not guaranteed to have the same base. + ///< The absolute value of the timestamp is only valid during within the + ///< application and may be different on the next execution. + +} ctl_freq_throttle_time_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of frequency domains +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumFrequencyDomains( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get frequency properties - available frequencies +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFrequency` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFrequencyGetProperties( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + ctl_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get available non-overclocked hardware clock frequencies for the +/// frequency domain +/// +/// @details +/// - The list of available frequencies is returned in order of slowest to +/// fastest. +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFrequency` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFrequencyGetAvailableClocks( + ctl_freq_handle_t hFrequency, ///< [in] Device handle of the device. + uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. + ///< if count is zero, then the driver shall update the value with the + ///< total number of frequencies that are available. + ///< if count is greater than the number of frequencies that are available, + ///< then the driver shall update the value with the correct number of frequencies. + double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of + ///< MHz and sorted from slowest to fastest. + ///< if count is less than the number of frequencies that are available, + ///< then the driver shall only retrieve that number of frequencies. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get current frequency limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFrequency` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLimits` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFrequencyGetRange( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + ctl_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the + ///< specified domain. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set frequency range between which the hardware can operate. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFrequency` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pLimits` +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFrequencySetRange( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + const ctl_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the + ///< specified domain. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get current frequency state - frequency request, actual frequency, TDP +/// limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFrequency` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFrequencyGetState( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + ctl_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get frequency throttle time +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFrequency` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pThrottleTime` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlFrequencyGetThrottleTime( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + ctl_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the + ///< specified domain. + ); + + +#if !defined(__GNUC__) +#pragma endregion // frequency +#endif +// Intel 'ctlApi' for Device Adapter +#if !defined(__GNUC__) +#pragma region media +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Feature type +typedef enum _ctl_video_processing_feature_t +{ + CTL_VIDEO_PROCESSING_FEATURE_FILM_MODE_DETECTION = 0, ///< Film mode detection. Contains CTL_PROPERTY_VALUE_TYPE_BOOL ValueType. + CTL_VIDEO_PROCESSING_FEATURE_NOISE_REDUCTION = 1, ///< Noise reduction. Contains CTL_PROPERTY_VALUE_TYPE_CUSTOM type field + ///< using struct ::ctl_video_processing_noise_reduction_t. + CTL_VIDEO_PROCESSING_FEATURE_SHARPNESS = 2, ///< Sharpness. Contains CTL_PROPERTY_VALUE_TYPE_UINT32 ValueType. + CTL_VIDEO_PROCESSING_FEATURE_ADAPTIVE_CONTRAST_ENHANCEMENT = 3, ///< Adaptive contrast enhancement. Contains + ///< CTL_PROPERTY_VALUE_TYPE_CUSTOM type field using struct + ///< ::ctl_video_processing_adaptive_contrast_enhancement_t. + CTL_VIDEO_PROCESSING_FEATURE_SUPER_RESOLUTION = 4, ///< Super resolution. Contains CTL_PROPERTY_VALUE_TYPE_CUSTOM ValueType + ///< using ::ctl_video_processing_super_resolution_t. By defaut, Super + ///< resolution is not active, need application to activate it, please + ///< contact Intel for super resolution activation. + CTL_VIDEO_PROCESSING_FEATURE_STANDARD_COLOR_CORRECTION = 5, ///< Standard color correction. Controls Hue, Saturation, Contrast, + ///< Brightness. Contains CTL_PROPERTY_VALUE_TYPE_CUSTOM type field using + ///< struct ::ctl_video_processing_standard_color_correction_t. + CTL_VIDEO_PROCESSING_FEATURE_TOTAL_COLOR_CORRECTION = 6,///< Total color correction. Controls Red, Green, Blue, Yellow, Cyan, + ///< Magenta. Contains CTL_PROPERTY_VALUE_TYPE_CUSTOM type field using + ///< struct ::ctl_video_processing_total_color_correction_t. + CTL_VIDEO_PROCESSING_FEATURE_SKIN_TONE_ENHANCEMENT = 7, ///< Skin tone enhancement. Contains CTL_PROPERTY_VALUE_TYPE_UINT32 + ///< ValueType. + CTL_VIDEO_PROCESSING_FEATURE_MAX + +} ctl_video_processing_feature_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Super resolution values possible +typedef uint32_t ctl_video_processing_super_resolution_flags_t; +typedef enum _ctl_video_processing_super_resolution_flag_t +{ + CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_DISABLE = CTL_BIT(0),///< Disable + CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_ENABLE_DEFAULT_SCENARIO_MODE = CTL_BIT(1), ///< Enable with default super resolution mode + CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_ENABLE_CONFERENCE_SCENARIO_MODE = CTL_BIT(2),///< Super resolution mode targeted at video conference content + CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_ENABLE_CAMERA_SCENARIO_MODE = CTL_BIT(3),///< Super resolution mode targeted at camera capture content (e.g. + ///< security camera) + CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_MAX = 0x80000000 + +} ctl_video_processing_super_resolution_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Super Resolution feature details structure to be used with +/// SUPER_RESOLUTION +typedef struct _ctl_video_processing_super_resolution_info_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_video_processing_super_resolution_flags_t super_resolution_flag;///< [in,out] SUPER_RESOLUTION flag + ctl_property_info_uint_t super_resolution_range_in_width; ///< [in,out] The range of input width information(min, max, default and + ///< step size)which super resolution is capable of supporting. + ctl_property_info_uint_t super_resolution_range_in_height; ///< [in,out] The range of input height information(min, max, default and + ///< step size)which super resolution is capable of supporting. + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_super_resolution_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Super Resolution Get/Set structure to be used with SUPER_RESOLUTION +typedef struct _ctl_video_processing_super_resolution_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_video_processing_super_resolution_flags_t super_resolution_flag;///< [in,out] SUPER_RESOLUTION flag + bool super_resolution_max_in_enabled; ///< [in,out] The enabling of maximum input width and height limition. If + ///< enabled, super resolution will always take effect if the input + ///< resolution is smaller than the below specified max resolution; + ///< otherwise, super_resolution_max_in_width and + ///< super_resolution_max_in_height will be ignored + uint32_t super_resolution_max_in_width; ///< [in,out] The maximum input width limition value setting which super + ///< resolution will be allowed to enabled. + uint32_t super_resolution_max_in_height; ///< [in,out] The maximum input height limiation value setting which super + ///< resolution will be allowed to enabled. + bool super_resolution_reboot_reset; ///< [in,out] Resetting of super resolution after rebooting. + uint32_t ReservedFields[15]; ///< [out] Reserved field of 60 bytes + char ReservedBytes[3]; ///< [out] Reserved field of 3 bytes + +} ctl_video_processing_super_resolution_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Noise Reduction feature details structure to be used with +/// NOISE_REDUCTION +typedef struct _ctl_video_processing_noise_reduction_info_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_property_info_uint_t noise_reduction; ///< [in,out] Noise reduction min, max, default and step size information + bool noise_reduction_auto_detect_supported; ///< [in,out] Noise reduction Auto Detect is supported; only valid if + ///< NOISE_REDUCTION is enabled. If enabled, noise reduction level is + ///< automatically determined and set value is not used. + ctl_property_info_boolean_t noise_reduction_auto_detect;///< [in,out] Noise reduction auto detect default information + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_noise_reduction_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Noise Reduction Get/Set structure to be used with NOISE_REDUCTION +typedef struct _ctl_video_processing_noise_reduction_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_property_uint_t noise_reduction; ///< [in,out] Noise reduction enable and value setting + ctl_property_boolean_t noise_reduction_auto_detect; ///< [in,out] Noise reduction auto detect setting + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_noise_reduction_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Adaptive Contrast Enhancement feature details structure to be used +/// with ADAPTIVE_CONTRAST_ENHANCEMENT +typedef struct _ctl_video_processing_adaptive_contrast_enhancement_info_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_property_info_uint_t adaptive_contrast_enhancement; ///< [in,out] Adaptive Contrast Enhancement min, max, default and step size + ///< information + bool adaptive_contrast_enhancement_coexistence_supported; ///< [in,out] Adaptive contrast enhancement coexistance is supported; only + ///< valid if ADAPTIVE_CONTRAST_ENHANCEMENT is enabled. If enabled, Video + ///< adaptive contrast ehancement will be allowed to be enabled and coexist + ///< with Display adaptive contrast ehancement feature. + ctl_property_info_boolean_t adaptive_contrast_enhancement_coexistence; ///< [in,out] Adaptive contrast enhancement coexistence default information + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_adaptive_contrast_enhancement_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Adaptive Contrast Enhancement Get/Set structure to be used with +/// ADAPTIVE_CONTRAST_ENHANCEMENT +typedef struct _ctl_video_processing_adaptive_contrast_enhancement_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_property_uint_t adaptive_contrast_enhancement; ///< [in,out] Adaptive Contrast Enhancement enable and value setting + ctl_property_boolean_t adaptive_contrast_enhancement_coexistence; ///< [in,out] Adaptive contrast enhancement coexistance setting + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_adaptive_contrast_enhancement_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Standard Color Correction feature details structure to be used with +/// STANDARD_COLOR_CORRECTION +typedef struct _ctl_video_processing_standard_color_correction_info_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool standard_color_correction_default_enable; ///< [in,out] STANDARD_COLOR_CORRECTION default enable setting. This + ///< global settings controls all of Hue, Saturation, Contrast, Brightness + ///< enabling. Individual Enable controls shall be ignored. + ctl_property_info_float_t brightness; ///< [in,out] Brightness min, max, default and step size information + ctl_property_info_float_t contrast; ///< [in,out] Contrast min, max, default and step size information + ctl_property_info_float_t hue; ///< [in,out] Hue min, max, default and step size information + ctl_property_info_float_t saturation; ///< [in,out] Saturation min, max, default and step size information + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_standard_color_correction_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Standard Color Correction Get/Set structure to be used with +/// STANDARD_COLOR_CORRECTION +typedef struct _ctl_video_processing_standard_color_correction_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool standard_color_correction_enable; ///< [in,out] STANDARD_COLOR_CORRECTION enable setting. This global + ///< setting controls all of Hue, Saturation, Contrast, Brightness + ///< enabling. + float brightness; ///< [in,out] Brightness value + float contrast; ///< [in,out] Contrast value + float hue; ///< [in,out] Hue value + float saturation; ///< [in,out] Saturation value + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_standard_color_correction_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Total Color Correction Get/Set structure to be used with +/// TOTAL_COLOR_CORRECTION +typedef struct _ctl_video_processing_total_color_correction_info_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool total_color_correction_default_enable; ///< [in,out] TOTAL_COLOR_CORRECTION enable setting. This global setting + ///< controls all of Red, Green, Blue, Yellow, Cyan, Magenta enabling. + ///< Individual Enable controls shall be ignored. + ctl_property_info_uint_t red; ///< [in,out] Red min, max, default and step size information + ctl_property_info_uint_t green; ///< [in,out] Green min, max, default and step size information + ctl_property_info_uint_t blue; ///< [in,out] Blue min, max, default and step size information + ctl_property_info_uint_t yellow; ///< [in,out] Yellow min, max, default and step size information + ctl_property_info_uint_t cyan; ///< [in,out] Cyan min, max, default and step size information + ctl_property_info_uint_t magenta; ///< [in,out] Magenta min, max, default and step size information + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_total_color_correction_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Total Color Correction Get/Set structure to be used with +/// TOTAL_COLOR_CORRECTION +typedef struct _ctl_video_processing_total_color_correction_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool total_color_correction_enable; ///< [in,out] TOTAL_COLOR_CORRECTION enable setting. This global setting + ///< controls all of Red, Green, Blue, Yellow, Cyan, Magenta enabling. + uint32_t red; ///< [in,out] Red value + uint32_t green; ///< [in,out] Green value + uint32_t blue; ///< [in,out] Blue value + uint32_t yellow; ///< [in,out] Yellow value + uint32_t cyan; ///< [in,out] Cyan value + uint32_t magenta; ///< [in,out] Magenta value + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_total_color_correction_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Video Processing feature details which will have range supported and +/// default values +typedef struct _ctl_video_processing_feature_details_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_video_processing_feature_t FeatureType; ///< [out] Video processing feature type + ctl_property_value_type_t ValueType; ///< [out] Type of value + ctl_property_info_t Value; ///< [out] Union of various type of values for Video Processing features. + ///< For enum types this can be noise reduction, color control etc. This + ///< member is valid iff ValueType is not CTL_PROPERTY_VALUE_TYPE_CUSTOM + int32_t CustomValueSize; ///< [in] CustomValue buffer size + void* pCustomValue; ///< [in,out] Pointer to a custom structure. Features that use CustomType, + ///< after the first query for all of the supported features the user needs + ///< to allocate this buffer and then query again just this specific + ///< feature for the structure to be filled in. Caller should allocate this + ///< buffer with known custom feature structure size. This member is valid + ///< iff ValueType is CTL_PROPERTY_VALUE_TYPE_CUSTOM. + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_feature_details_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Video Processing features which are controllable +typedef struct _ctl_video_processing_feature_caps_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t NumSupportedFeatures; ///< [in,out] Number of elements in supported features array + ctl_video_processing_feature_details_t* pFeatureDetails;///< [in,out] Array of supported features and their details + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_feature_caps_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Video Processing feature for get/set +typedef struct _ctl_video_processing_feature_getset_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_video_processing_feature_t FeatureType; ///< [in] Features interested in + char* ApplicationName; ///< [in] Application name for which the property type is applicable. If + ///< this is an empty string then this will get/set global settings for the + ///< given adapter. Note that this should contain only the name of the + ///< application and not the system specific path. [This is not currently + ///< supported and should be an empty string.] + int8_t ApplicationNameLength; ///< [in] Length of ApplicationName string + bool bSet; ///< [in] Set this if it's a set call + ctl_property_value_type_t ValueType; ///< [in] Type of value. Caller has to ensure it provides the right value + ///< type which decides how one read the union structure below + ctl_property_t Value; ///< [in,out] Union of various type of values for Video Processing + ///< features. For enum types this can be noise reduction, color control + ///< etc. This member is valid iff ValueType is not + ///< CTL_PROPERTY_VALUE_TYPE_CUSTOM + int32_t CustomValueSize; ///< [in] CustomValue buffer size. For a feature requiring custom struct, + ///< caller will know of it upfront the struct to use based on the feautre + ///< and can provide the right size info here + void* pCustomValue; ///< [in,out] Pointer to a custom structure. Caller should allocate this + ///< buffer with known custom feature structure size. This member is valid + ///< iff ValueType is CTL_PROPERTY_VALUE_TYPE_CUSTOM + uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes + +} ctl_video_processing_feature_getset_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Video Processing capabilities +/// +/// @details +/// - The application gets Video Processing properties +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pFeatureCaps` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSupportedVideoProcessingCapabilities( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_video_processing_feature_caps_t* pFeatureCaps ///< [in,out][release] Video Processing properties + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get/Set Video Processing feature details +/// +/// @details +/// - Video Processing feature details +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pFeature` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetSetVideoProcessingFeature( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_video_processing_feature_getset_t* pFeature ///< [in][release] Video Processing feature get/set parameter + ); + + +#if !defined(__GNUC__) +#pragma endregion // media +#endif +// Intel 'ctlApi' for Device Adapter - Memory management +#if !defined(__GNUC__) +#pragma region memory +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory module types +typedef enum _ctl_mem_type_t +{ + CTL_MEM_TYPE_HBM = 0, ///< HBM memory + CTL_MEM_TYPE_DDR = 1, ///< DDR memory + CTL_MEM_TYPE_DDR3 = 2, ///< DDR3 memory + CTL_MEM_TYPE_DDR4 = 3, ///< DDR4 memory + CTL_MEM_TYPE_DDR5 = 4, ///< DDR5 memory + CTL_MEM_TYPE_LPDDR = 5, ///< LPDDR memory + CTL_MEM_TYPE_LPDDR3 = 6, ///< LPDDR3 memory + CTL_MEM_TYPE_LPDDR4 = 7, ///< LPDDR4 memory + CTL_MEM_TYPE_LPDDR5 = 8, ///< LPDDR5 memory + CTL_MEM_TYPE_GDDR4 = 9, ///< GDDR4 memory + CTL_MEM_TYPE_GDDR5 = 10, ///< GDDR5 memory + CTL_MEM_TYPE_GDDR5X = 11, ///< GDDR5X memory + CTL_MEM_TYPE_GDDR6 = 12, ///< GDDR6 memory + CTL_MEM_TYPE_GDDR6X = 13, ///< GDDR6X memory + CTL_MEM_TYPE_GDDR7 = 14, ///< GDDR7 memory + CTL_MEM_TYPE_UNKNOWN = 15, ///< UNKNOWN memory + CTL_MEM_TYPE_MAX + +} ctl_mem_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory module location +typedef enum _ctl_mem_loc_t +{ + CTL_MEM_LOC_SYSTEM = 0, ///< System memory + CTL_MEM_LOC_DEVICE = 1, ///< On board local device memory + CTL_MEM_LOC_MAX + +} ctl_mem_loc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory properties +typedef struct _ctl_mem_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_mem_type_t type; ///< [out] The memory type + ctl_mem_loc_t location; ///< [out] Location of this memory (system, device) + uint64_t physicalSize; ///< [out] Physical memory size in bytes. A value of 0 indicates that this + ///< property is not known. However, a call to ::ctlMemoryGetState() will + ///< correctly return the total size of usable memory. + int32_t busWidth; ///< [out] Width of the memory bus. A value of -1 means that this property + ///< is unknown. + int32_t numChannels; ///< [out] The number of memory channels. A value of -1 means that this + ///< property is unknown. + +} ctl_mem_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory state - health, allocated +/// +/// @details +/// - Percent allocation is given by 100 * (size - free / size. +/// - Percent free is given by 100 * free / size. +typedef struct _ctl_mem_state_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint64_t free; ///< [out] The free memory in bytes + uint64_t size; ///< [out] The total allocatable memory in bytes (can be less than + ///< ::ctl_mem_properties_t.physicalSize) + +} ctl_mem_state_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Memory bandwidth +/// +/// @details +/// - Percent bandwidth is calculated by taking two snapshots (s1, s2) and +/// using the equation: %bw = 10^6 * ((s2.readCounter - s1.readCounter) + +/// (s2.writeCounter - s1.writeCounter)) / (s2.maxBandwidth * +/// (s2.timestamp - s1.timestamp)) +typedef struct _ctl_mem_bandwidth_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint64_t maxBandwidth; ///< [out] Current maximum bandwidth in units of bytes/sec + uint64_t timestamp; ///< [out] The timestamp (in microseconds) when these measurements were sampled. + ///< This timestamp should only be used to calculate delta time between + ///< snapshots of this structure. + ///< Never take the delta of this timestamp with the timestamp from a + ///< different structure since they are not guaranteed to have the same base. + ///< The absolute value of the timestamp is only valid during within the + ///< application and may be different on the next execution. + uint64_t readCounter; ///< [out] Total bytes read from memory. Supported only for Version > 0 + uint64_t writeCounter; ///< [out] Total bytes written to memory. Supported only for Version > 0 + +} ctl_mem_bandwidth_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of memory modules +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumMemoryModules( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get memory properties +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hMemory` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlMemoryGetProperties( + ctl_mem_handle_t hMemory, ///< [in] Handle for the component. + ctl_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get memory state - health, allocated +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hMemory` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlMemoryGetState( + ctl_mem_handle_t hMemory, ///< [in] Handle for the component. + ctl_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get memory bandwidth +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hMemory` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pBandwidth` +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to query this telemetry. +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlMemoryGetBandwidth( + ctl_mem_handle_t hMemory, ///< [in] Handle for the component. + ctl_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the current health, free memory, total memory + ///< size. + ); + + +#if !defined(__GNUC__) +#pragma endregion // memory +#endif +// Intel 'ctlApi' for Device Adapter - Overclock +#if !defined(__GNUC__) +#pragma region overclock +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Telemetry Item for each telemetry property +/// +/// @details +/// - If the supported field is true, then the entire structure has valid +/// information. +/// - The ::ctl_data_value_t is of type ::ctl_data_type_t and units +/// ::ctl_units_t +typedef struct _ctl_oc_telemetry_item_t +{ + bool bSupported; ///< [out] Indicates if the value is supported. + ctl_units_t units; ///< [out] Indicates the units of the value. + ctl_data_type_t type; ///< [out] Indicates the data type. + ctl_data_value_t value; ///< [out] The value of type ::ctl_data_type_t and units ::ctl_units_t. + +} ctl_oc_telemetry_item_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Overclocking Control Information +/// +/// @details +/// - Whether the device supports overclocking. +/// - The +/// bSupported/bRelative/bReference/units/min/max/step/default/reference +/// values for the available overclock controls +/// - The idea is to facilitate the way the applications present overclock +/// settings to the user. If bSupported is false, the corresponding +/// overclock control is not supported +/// - The setting units will be an enum that enables the application to know +/// the units for the control setting e.g. MHz. The min and max settings +/// give the limits for the control. +/// - The step setting gives the minimum change in the control value (plus +/// or minus) - if a control is not changed by at least this amount, the +/// hardware may round up or down. +/// - The default values gives the manufacturing setting for the control. +/// Some controls such as frequency offset and voltage offset are +/// relative; in this case, bRelative will be true, otherwise the control +/// settings are absolute values. +/// - For relative controls and if bReference is true, the reference value +/// gives the absolute value at the default setting. +/// - If bReference is false, the absolute value of the default setting is +/// no not known and it is probably better to display the setting to users +/// as percentage offsets. +typedef struct _ctl_oc_control_info_t +{ + bool bSupported; ///< [out] Indicates if the values are known. + bool bRelative; ///< [out] Indicates if the values are meant to be taken as relative values + ///< instead of absolut values. + bool bReference; ///< [out] For relative values, this indicates if a reference is available. + ctl_units_t units; ///< [out] Units for the values. + double min; ///< [out] Minimum Value. + double max; ///< [out] Maximum Value. + double step; ///< [out] Step Value. + double Default; ///< [out] Default Value. + double reference; ///< [out] Reference Value if the bReference is true. + +} ctl_oc_control_info_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Overclock properties +typedef struct _ctl_oc_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool bSupported; ///< [out] Indicates if the adapter supports overclocking. + ctl_oc_control_info_t gpuFrequencyOffset; ///< [out] related to function ::ctlOverclockGpuFrequencyOffsetSet + ctl_oc_control_info_t gpuVoltageOffset; ///< [out] related to function ::ctlOverclockGpuVoltageOffsetSet + ctl_oc_control_info_t vramFrequencyOffset; ///< [out] Property Field Deprecated / No Longer Supported + ctl_oc_control_info_t vramVoltageOffset; ///< [out] Property Field Deprecated / No Longer Supported + ctl_oc_control_info_t powerLimit; ///< [out] related to function ::ctlOverclockPowerLimitSet + ctl_oc_control_info_t temperatureLimit; ///< [out] related to function ::ctlOverclockTemperatureLimitSet + +} ctl_oc_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Overclock Voltage Frequency Pair +typedef struct _ctl_oc_vf_pair_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + double Voltage; ///< [in,out] Voltage component of the pair in mV. + double Frequency; ///< [in,out] Frequency component of the pair in MHz. + +} ctl_oc_vf_pair_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_PSU_COUNT +/// @brief Maximum number power supply units. +#define CTL_PSU_COUNT 5 +#endif // CTL_PSU_COUNT + +/////////////////////////////////////////////////////////////////////////////// +/// @brief PSU Type. +typedef enum _ctl_psu_type_t +{ + CTL_PSU_TYPE_PSU_NONE = 0, ///< Type of the PSU is unknown. + CTL_PSU_TYPE_PSU_PCIE = 1, ///< Type of the PSU is PCIe + CTL_PSU_TYPE_PSU_6PIN = 2, ///< Type of the PSU is 6 PIN + CTL_PSU_TYPE_PSU_8PIN = 3, ///< Type of the PSU is 8 PIN + CTL_PSU_TYPE_MAX + +} ctl_psu_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief PSU Info +typedef struct _ctl_psu_info_t +{ + bool bSupported; ///< [out] Indicates if this PSU entry is supported. + ctl_psu_type_t psuType; ///< [out] Type of the PSU. + ctl_oc_telemetry_item_t energyCounter; ///< [out] Snapshot of the monotonic energy counter maintained by hardware. + ///< It measures the total energy consumed this power source. By taking the + ///< delta between two snapshots and dividing by the delta time in seconds, + ///< an application can compute the average power. + ctl_oc_telemetry_item_t voltage; ///< [out] Instantaneous snapshot of the voltage of this power source. + +} ctl_psu_info_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_FAN_COUNT +/// @brief Maximum number of Fans +#define CTL_FAN_COUNT 5 +#endif // CTL_FAN_COUNT + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Power Telemetry +typedef struct _ctl_power_telemetry_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_oc_telemetry_item_t timeStamp; ///< [out] Snapshot of the timestamp counter that measures the total time + ///< since Jan 1, 1970 UTC. It is a decimal value in seconds with a minimum + ///< accuracy of 1 millisecond. + ctl_oc_telemetry_item_t gpuEnergyCounter; ///< [out] Snapshot of the monotonic energy counter maintained by hardware. + ///< It measures the total energy consumed by the GPU chip. By taking the + ///< delta between two snapshots and dividing by the delta time in seconds, + ///< an application can compute the average power. + ctl_oc_telemetry_item_t gpuVoltage; ///< [out] Instantaneous snapshot of the voltage feeding the GPU chip. It + ///< is measured at the power supply output - chip input will be lower. + ctl_oc_telemetry_item_t gpuCurrentClockFrequency; ///< [out] Instantaneous snapshot of the GPU chip frequency. + ctl_oc_telemetry_item_t gpuCurrentTemperature; ///< [out] Instantaneous snapshot of the GPU chip temperature, read from + ///< the sensor reporting the highest value. + ctl_oc_telemetry_item_t globalActivityCounter; ///< [out] Snapshot of the monotonic global activity counter. It measures + ///< the time in seconds (accurate down to 1 millisecond) that any GPU + ///< engine is busy. By taking the delta between two snapshots and dividing + ///< by the delta time in seconds, an application can compute the average + ///< percentage utilization of the GPU.. + ctl_oc_telemetry_item_t renderComputeActivityCounter; ///< [out] Snapshot of the monotonic 3D/compute activity counter. It + ///< measures the time in seconds (accurate down to 1 millisecond) that any + ///< 3D render/compute engine is busy. By taking the delta between two + ///< snapshots and dividing by the delta time in seconds, an application + ///< can compute the average percentage utilization of all 3D + ///< render/compute blocks in the GPU. + ctl_oc_telemetry_item_t mediaActivityCounter; ///< [out] Snapshot of the monotonic media activity counter. It measures + ///< the time in seconds (accurate down to 1 millisecond) that any media + ///< engine is busy. By taking the delta between two snapshots and dividing + ///< by the delta time in seconds, an application can compute the average + ///< percentage utilization of all media blocks in the GPU. + bool gpuPowerLimited; ///< [out] Instantaneous indication that the desired GPU frequency is being + ///< throttled because the GPU chip is exceeding the maximum power limits. + ///< Increasing the power limits using ::ctlOverclockPowerLimitSet() is one + ///< way to remove this limitation. + bool gpuTemperatureLimited; ///< [out] Instantaneous indication that the desired GPU frequency is being + ///< throttled because the GPU chip is exceeding the temperature limits. + ///< Increasing the temperature limits using + ///< ::ctlOverclockTemperatureLimitSet() is one way to reduce this + ///< limitation. Improving the cooling solution is another way. + bool gpuCurrentLimited; ///< [out] Instantaneous indication that the desired GPU frequency is being + ///< throttled because the GPU chip has exceeded the power supply current + ///< limits. A better power supply is required to reduce this limitation. + bool gpuVoltageLimited; ///< [out] Instantaneous indication that the GPU frequency cannot be + ///< increased because the voltage limits have been reached. Increase the + ///< voltage offset using ::ctlOverclockGpuVoltageOffsetSet() is one way to + ///< reduce this limitation. + bool gpuUtilizationLimited; ///< [out] Instantaneous indication that due to lower GPU utilization, the + ///< hardware has lowered the GPU frequency. + ctl_oc_telemetry_item_t vramEnergyCounter; ///< [out] Snapshot of the monotonic energy counter maintained by hardware. + ///< It measures the total energy consumed by the local memory modules. By + ///< taking the delta between two snapshots and dividing by the delta time + ///< in seconds, an application can compute the average power. + ctl_oc_telemetry_item_t vramVoltage; ///< [out] Instantaneous snapshot of the voltage feeding the memory + ///< modules. + ctl_oc_telemetry_item_t vramCurrentClockFrequency; ///< [out] Instantaneous snapshot of the raw clock frequency driving the + ///< memory modules. + ctl_oc_telemetry_item_t vramCurrentEffectiveFrequency; ///< [out] Instantaneous snapshot of the effective data transfer rate that + ///< the memory modules can sustain based on the current clock frequency.. + ctl_oc_telemetry_item_t vramReadBandwidthCounter; ///< [out] Instantaneous snapshot of the monotonic counter that measures + ///< the read traffic from the memory modules. By taking the delta between + ///< two snapshots and dividing by the delta time in seconds, an + ///< application can compute the average read bandwidth. + ctl_oc_telemetry_item_t vramWriteBandwidthCounter; ///< [out] Instantaneous snapshot of the monotonic counter that measures + ///< the write traffic to the memory modules. By taking the delta between + ///< two snapshots and dividing by the delta time in seconds, an + ///< application can compute the average write bandwidth. + ctl_oc_telemetry_item_t vramCurrentTemperature; ///< [out] Instantaneous snapshot of the GPU chip temperature, read from + ///< the sensor reporting the highest value. + bool vramPowerLimited; ///< [out] Instantaneous indication that the memory frequency is being + ///< throttled because the memory modules are exceeding the maximum power + ///< limits. + bool vramTemperatureLimited; ///< [out] Instantaneous indication that the memory frequency is being + ///< throttled because the memory modules are exceeding the temperature + ///< limits. + bool vramCurrentLimited; ///< [out] Instantaneous indication that the memory frequency is being + ///< throttled because the memory modules have exceeded the power supply + ///< current limits. + bool vramVoltageLimited; ///< [out] Instantaneous indication that the memory frequency cannot be + ///< increased because the voltage limits have been reached. + bool vramUtilizationLimited; ///< [out] Instantaneous indication that due to lower memory traffic, the + ///< hardware has lowered the memory frequency. + ctl_oc_telemetry_item_t totalCardEnergyCounter; ///< [out] Total Card Energy Counter. + ctl_psu_info_t psu[CTL_PSU_COUNT]; ///< [out] PSU voltage and power. + ctl_oc_telemetry_item_t fanSpeed[CTL_FAN_COUNT];///< [out] Fan speed. + +} ctl_power_telemetry_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get overclock properties - available properties. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGetProperties( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + ctl_oc_properties_t* pOcProperties ///< [in,out] The overclocking properties for the specified domain. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Overclock Waiver - Warranty Waiver. +/// +/// @details +/// - Most of the overclock functions will return an error if the waiver is +/// not set. This is because most overclock settings will increase the +/// electric/thermal stress on the part and thus reduce its lifetime. +/// - By setting the waiver, the user is indicate that they are accepting a +/// reduction in the lifetime of the part. +/// - It is the responsibility of overclock applications to notify each user +/// at least once with a popup of the dangers and requiring acceptance. +/// - Only once the user has accepted should this function be called by the +/// application. +/// - It is acceptable for the application to cache the user choice and call +/// this function on future executions without issuing the popup. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockWaiverSet( + ctl_device_adapter_handle_t hDeviceHandle ///< [in][release] Handle to display adapter + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the Overclock Frequency Offset for the GPU in MHz. +/// +/// @details +/// - Determine the current frequency offset in effect (refer to +/// ::ctlOverclockGpuFrequencyOffsetSet() for details). +/// - The value returned may be different from the value that was previously +/// set by the application depending on hardware limitations or if the +/// function ::ctlOverclockGpuFrequencyOffsetSet() has been called or +/// another application that has changed the value. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcFrequencyOffset` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuFrequencyOffsetGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcFrequencyOffset ///< [in,out] The Turbo Overclocking Frequency Desired in MHz. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the Overclock Frequency Offset for the GPU in MHZ. +/// +/// @details +/// - The purpose of this function is to increase/decrease the frequency at +/// which typical workloads will run within the same thermal budget. +/// - The frequency offset is expressed in units of ±1MHz. +/// - The actual operating frequency for each workload is not guaranteed to +/// change exactly by the specified offset. +/// - For positive frequency offsets, the factory maximum frequency may +/// increase by up to the specified amount. +/// - For negative frequency offsets, the overclock waiver must have been +/// set since this can result in running the part at voltages beyond the +/// part warrantee limits. An error is returned if the waiver has not been +/// set. +/// - Specifying large values for the frequency offset can lead to +/// instability. It is recommended that changes are made in small +/// increments and stability/performance measured running intense GPU +/// workloads before increasing further. +/// - This setting is not persistent through system reboots or driver +/// resets/hangs. It is up to the overclock application to reapply the +/// settings in those cases. +/// - This setting can cause system/device instability. It is up to the +/// overclock application to detect if the system has rebooted +/// unexpectedly or the device was restarted. When this occurs, the +/// application should not reapply the overclock settings automatically +/// but instead return to previously known good settings or notify the +/// user that the settings are not being applied. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuFrequencyOffsetSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocFrequencyOffset ///< [in] The Turbo Overclocking Frequency Desired in MHz. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the Overclock Gpu Voltage Offset in mV. +/// +/// @details +/// - Determine the current voltage offset in effect on the hardware (refer +/// to ::ctlOverclockGpuVoltageOffsetSet for details). +/// - The value returned may be different from the value that was previously +/// set by the application depending on hardware limitations or if the +/// function ::ctlOverclockGpuVoltageOffsetSet has been called or another +/// application that has changed the value. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcVoltageOffset` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuVoltageOffsetGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcVoltageOffset ///< [in,out] The Turbo Overclocking Frequency Desired in mV. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the Overclock Gpu Voltage Offset in mV. +/// +/// @details +/// - The purpose of this function is to attempt to run the GPU up to higher +/// voltages beyond the part warrantee limits. This can permit running at +/// even higher frequencies than can be obtained using the frequency +/// offset setting, but at the risk of reducing the lifetime of the part. +/// - The voltage offset is expressed in units of ±millivolts with values +/// permitted down to a resolution of 1 millivolt. +/// - The overclock waiver must be set before calling this function +/// otherwise and error will be returned. +/// - There is no guarantee that a workload can operate at the higher +/// frequencies permitted by this setting. Significantly more heat will be +/// generated at these high frequencies/voltages which will necessitate a +/// good cooling solution. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuVoltageOffsetSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocVoltageOffset ///< [in] The Turbo Overclocking Frequency Desired in mV. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Gets the Locked GPU Voltage for Overclocking in mV. +/// +/// @details +/// - The purpose of this function is to determine if the current values of +/// the frequency/voltage lock. +/// - If the lock is not currently active, will return 0 for frequency and +/// voltage. +/// - Note that the operating frequency/voltage may be lower than these +/// settings if power/thermal limits are exceeded. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pVfPair` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuLockGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + ctl_oc_vf_pair_t* pVfPair ///< [out] The current locked voltage and frequency. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Locks the GPU voltage for Overclocking in mV. +/// +/// @details +/// - The purpose of this function is to provide an interface for scanners +/// to lock the frequency and voltage to fixed values. +/// - The frequency is expressed in units of MHz with a resolution of 1MHz. +/// - The voltage is expressed in units of ±millivolts with values +/// permitted down to a resolution of 1 millivolt. +/// - The overclock waiver must be set since fixing the voltage at a high +/// value puts unnecessary stress on the part. +/// - The actual frequency may reduce depending on power/thermal +/// limitations. +/// - Requesting a frequency and/or voltage of 0 will return the hardware to +/// dynamic frequency/voltage management with any previous frequency +/// offset or voltage offset settings reapplied. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuLockSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + ctl_oc_vf_pair_t vFPair ///< [in] The current locked voltage and frequency. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the current Vram Frequency Offset in GT/s. +/// +/// @details +/// - The purpose of this function is to return the current VRAM frequency +/// offset in units of GT/s. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcFrequencyOffset` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockVramFrequencyOffsetGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcFrequencyOffset ///< [in,out] The current Memory Frequency in GT/s. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the desired Vram frquency Offset in GT/s +/// +/// @details +/// - The purpose of this function is to increase/decrease the frequency of +/// VRAM. +/// - The frequency offset is expressed in units of GT/s with a minimum step +/// size given by ::ctlOverclockGetProperties. +/// - The actual operating frequency for each workload is not guaranteed to +/// change exactly by the specified offset. +/// - The waiver must be set using clibOverclockWaiverSet() before this +/// function can be called. +/// - This setting is not persistent through system reboots or driver +/// resets/hangs. It is up to the overclock application to reapply the +/// settings in those cases. +/// - This setting can cause system/device instability. It is up to the +/// overclock application to detect if the system has rebooted +/// unexpectedly or the device was restarted. When this occurs, the +/// application should not reapply the overclock settings automatically +/// but instead return to previously known good settings or notify the +/// user that the settings are not being applied. +/// - If the memory controller doesn't support changes to frequency on the +/// fly, one of the following return codes will be given: +/// - ::CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory +/// overclock will be applied when the device is reset or the system is +/// rebooted. In this case, the overclock software should check if the +/// overclock request was applied after the reset/reboot. If it was and +/// when the overclock application shuts down gracefully and if the +/// overclock application wants the setting to be persistent, the +/// application should request the same overclock settings again so that +/// they will be applied on the next reset/reboot. If this is not done, +/// then every time the device is reset and overclock is requested, the +/// device needs to be reset a second time. +/// - ::CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory +/// overclock will be applied when the system is rebooted. In this case, +/// the overclock software should check if the overclock request was +/// applied after the reboot. If it was and when the overclock application +/// shuts down gracefully and if the overclock application wants the +/// setting to be persistent, the application should request the same +/// overclock settings again so that they will be applied on the next +/// reset/reboot. If this is not done and the overclock setting is +/// requested after the reboot has occurred, a second reboot will be +/// required. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockVramFrequencyOffsetSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocFrequencyOffset ///< [in] The desired Memory Frequency in GT/s. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the Overclock Vram Voltage Offset in mV. +/// +/// @details +/// - The purpose of this function is to increase/decrease the voltage of +/// VRAM. +/// - The voltage offset is expressed in units of millivolts with a minimum +/// step size given by ::ctlOverclockGetProperties. +/// - The waiver must be set using ::ctlOverclockWaiverSet before this +/// function can be called. +/// - This setting is not persistent through system reboots or driver +/// resets/hangs. It is up to the overclock application to reapply the +/// settings in those cases. +/// - This setting can cause system/device instability. It is up to the +/// overclock application to detect if the system has rebooted +/// unexpectedly or the device was restarted. When this occurs, the +/// application should not reapply the overclock settings automatically +/// but instead return to previously known good settings or notify the +/// user that the settings are not being applied. +/// - If the memory controller doesn't support changes to voltage on the +/// fly, one of the following return codes will be given: +/// - ::CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory +/// overclock will be applied when the device is reset or the system is +/// rebooted. In this case, the overclock software should check if the +/// overclock request was applied after the reset/reboot. If it was and +/// when the overclock application shuts down gracefully and if the +/// overclock application wants the setting to be persistent, the +/// application should request the same overclock settings again so that +/// they will be applied on the next reset/reboot. If this is not done, +/// then every time the device is reset and overclock is requested, the +/// device needs to be reset a second time. +/// - ::CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory +/// overclock will be applied when the system is rebooted. In this case, +/// the overclock software should check if the overclock request was +/// applied after the reboot. If it was and when the overclock application +/// shuts down gracefully and if the overclock application wants the +/// setting to be persistent, the application should request the same +/// overclock settings again so that they will be applied on the next +/// reset/reboot. If this is not done and the overclock setting is +/// requested after the reboot has occurred, a second reboot will be +/// required. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pVoltage` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockVramVoltageOffsetGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pVoltage ///< [out] The current locked voltage in mV. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the Overclock Vram Voltage Offset in mV. +/// +/// @details +/// - The purpose of this function is to set the maximum sustained power +/// limit. If the average GPU power averaged over a few seconds exceeds +/// this value, the frequency of the GPU will be throttled. +/// - Set a value of 0 to disable this power limit. In this case, the GPU +/// frequency will not throttle due to average power but may hit other +/// limits. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockVramVoltageOffsetSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double voltage ///< [in] The voltage to be locked in mV. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the sustained power limit in mW. +/// +/// @details +/// - The purpose of this function is to read the current sustained power +/// limit. +/// - A value of 0 means that the limit is disabled - the GPU frequency can +/// run as high as possible until other limits are hit. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSustainedPowerLimit` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockPowerLimitGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pSustainedPowerLimit ///< [in,out] The current sustained power limit in mW. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the sustained power limit in mW. +/// +/// @details +/// - The purpose of this function is to set the maximum sustained power +/// limit. If the average GPU power averaged over a few seconds exceeds +/// this value, the frequency of the GPU will be throttled. +/// - Set a value of 0 to disable this power limit. In this case, the GPU +/// frequency will not throttle due to average power but may hit other +/// limits. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockPowerLimitSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double sustainedPowerLimit ///< [in] The desired sustained power limit in mW. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the current temperature limit in Celsius. +/// +/// @details +/// - The purpose of this function is to read the current thermal limit. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pTemperatureLimit` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockTemperatureLimitGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pTemperatureLimit ///< [in,out] The current temperature limit in Celsius. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the temperature limit in Celsius. +/// +/// @details +/// - The purpose of this function is to change the maximum thermal limit. +/// When the GPU temperature exceeds this value, the GPU frequency will be +/// throttled. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockTemperatureLimitSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double temperatureLimit ///< [in] The desired temperature limit in Celsius. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Power Telemetry. +/// +/// @details +/// - Limited rate of 50 ms, any call under 50 ms will return the same +/// information. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pTelemetryInfo` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPowerTelemetryGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + ctl_power_telemetry_t* pTelemetryInfo ///< [out] The overclocking properties for the specified domain. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Reset all Overclock Settings to stock +/// +/// @details +/// - Reset all Overclock setting to default using single API call +/// - This request resets any changes made to GpuFrequencyOffset, +/// GpuVoltageOffset, PowerLimit, TemperatureLimit, GpuLock +/// - This Doesn't reset any Fan Curve Changes. It can be reset using +/// ctlFanSetDefaultMode +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockResetToDefault( + ctl_device_adapter_handle_t hDeviceHandle ///< [in][release] Handle to display adapter + ); + + +#if !defined(__GNUC__) +#pragma endregion // overclock +#endif +// Intel 'ctlApi' for Device Adapter - PCI Information +#if !defined(__GNUC__) +#pragma region pci +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief PCI address +typedef struct _ctl_pci_address_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint32_t domain; ///< [out] BDF domain + uint32_t bus; ///< [out] BDF bus + uint32_t device; ///< [out] BDF device + uint32_t function; ///< [out] BDF function + +} ctl_pci_address_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief PCI speed +typedef struct _ctl_pci_speed_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + int32_t gen; ///< [out] The link generation. A value of -1 means that this property is + ///< unknown. + int32_t width; ///< [out] The number of lanes. A value of -1 means that this property is + ///< unknown. + int64_t maxBandwidth; ///< [out] The maximum bandwidth in bytes/sec (sum of all lanes). A value + ///< of -1 means that this property is unknown. + +} ctl_pci_speed_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Static PCI properties +typedef struct _ctl_pci_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_pci_address_t address; ///< [out] The BDF address + ctl_pci_speed_t maxSpeed; ///< [out] Fastest port configuration supported by the device (sum of all + ///< lanes) + bool resizable_bar_supported; ///< [out] Support for Resizable Bar on this device. + bool resizable_bar_enabled; ///< [out] Resizable Bar enabled on this device + +} ctl_pci_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Dynamic PCI state +typedef struct _ctl_pci_state_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_pci_speed_t speed; ///< [out] The current port configure speed + +} ctl_pci_state_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get PCI properties - address, max speed +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPciGetProperties( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get current PCI state - current speed +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPciGetState( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_pci_state_t* pState ///< [in,out] Will contain the PCI properties. + ); + + +#if !defined(__GNUC__) +#pragma endregion // pci +#endif +// Intel 'ctlApi' for Device Adapter - Power management +#if !defined(__GNUC__) +#pragma region power +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Properties related to device power settings +typedef struct _ctl_power_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool canControl; ///< [out] Software can change the power limits of this domain assuming the + ///< user has permissions. + int32_t defaultLimit; ///< [out] The factory default TDP power limit of the part in milliwatts. A + ///< value of -1 means that this is not known. + int32_t minLimit; ///< [out] The minimum power limit in milliwatts that can be requested. + int32_t maxLimit; ///< [out] The maximum power limit in milliwatts that can be requested. + +} ctl_power_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Energy counter snapshot +/// +/// @details +/// - Average power is calculated by taking two snapshots (s1, s2) and using +/// the equation: PowerWatts = (s2.energy - s1.energy) / (s2.timestamp - +/// s1.timestamp) +typedef struct _ctl_power_energy_counter_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + uint64_t energy; ///< [out] The monotonic energy counter in microjoules. + uint64_t timestamp; ///< [out] Microsecond timestamp when energy was captured. + ///< This timestamp should only be used to calculate delta time between + ///< snapshots of this structure. + ///< Never take the delta of this timestamp with the timestamp from a + ///< different structure since they are not guaranteed to have the same base. + ///< The absolute value of the timestamp is only valid during within the + ///< application and may be different on the next execution. + +} ctl_power_energy_counter_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Sustained power limits +/// +/// @details +/// - The power controller (Punit) will throttle the operating frequency if +/// the power averaged over a window (typically seconds) exceeds this +/// limit. +typedef struct _ctl_power_sustained_limit_t +{ + bool enabled; ///< [in,out] indicates if the limit is enabled (true) or ignored (false) + int32_t power; ///< [in,out] power limit in milliwatts + int32_t interval; ///< [in,out] power averaging window (Tau) in milliseconds + +} ctl_power_sustained_limit_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Burst power limit +/// +/// @details +/// - The power controller (Punit) will throttle the operating frequency of +/// the device if the power averaged over a few milliseconds exceeds a +/// limit known as PL2. Typically PL2 > PL1 so that it permits the +/// frequency to burst higher for short periods than would be otherwise +/// permitted by PL1. +typedef struct _ctl_power_burst_limit_t +{ + bool enabled; ///< [in,out] indicates if the limit is enabled (true) or ignored (false) + int32_t power; ///< [in,out] power limit in milliwatts + +} ctl_power_burst_limit_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Peak power limit +/// +/// @details +/// - The power controller (Punit) will preemptively throttle the operating +/// frequency of the device when the instantaneous power exceeds this +/// limit. The limit is known as PL4. It expresses the maximum power that +/// can be drawn from the power supply. +/// - If this power limit is removed or set too high, the power supply will +/// generate an interrupt when it detects an overcurrent condition and the +/// power controller will throttle the device frequencies down to min. It +/// is thus better to tune the PL4 value in order to avoid such +/// excursions. +typedef struct _ctl_power_peak_limit_t +{ + int32_t powerAC; ///< [in,out] power limit in milliwatts for the AC power source. + int32_t powerDC; ///< [in,out] power limit in milliwatts for the DC power source. On input, + ///< this is ignored if the product does not have a battery. On output, + ///< this will be -1 if the product does not have a battery. + +} ctl_power_peak_limit_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Power limits +typedef struct _ctl_power_limits_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_power_sustained_limit_t sustainedPowerLimit;///< [in,out] sustained power limit. + ctl_power_burst_limit_t burstPowerLimit; ///< [in,out] burst power limit. + ctl_power_peak_limit_t peakPowerLimits; ///< [in,out] peak power limit. + +} ctl_power_limits_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Energy threshold +/// +/// @details +/// - . +typedef struct _ctl_energy_threshold_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool enable; ///< [in,out] Indicates if the energy threshold is enabled. + double threshold; ///< [in,out] The energy threshold in Joules. Will be 0.0 if no threshold + ///< has been set. + uint32_t processId; ///< [in,out] The host process ID that set the energy threshold. Will be + ///< 0xFFFFFFFF if no threshold has been set. + +} ctl_energy_threshold_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of power domains +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumPowerDomains( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get properties related to a power domain +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPowerGetProperties( + ctl_pwr_handle_t hPower, ///< [in] Handle for the component. + ctl_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get energy counter +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pEnergy` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPowerGetEnergyCounter( + ctl_pwr_handle_t hPower, ///< [in] Handle for the component. + ctl_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and + ///< timestamp when the last counter value was measured. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get power limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPowerGetLimits( + ctl_pwr_handle_t hPower, ///< [in] Handle for the component. + ctl_power_limits_t* pPowerLimits ///< [in,out][optional] Structure that will contain the power limits. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set power limits +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hPower` +/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +/// + User does not have permissions to make these modifications. +/// - ::CTL_RESULT_ERROR_NOT_AVAILABLE +/// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlPowerSetLimits( + ctl_pwr_handle_t hPower, ///< [in] Handle for the component. + const ctl_power_limits_t* pPowerLimits ///< [in][optional] Structure that will contain the power limits. + ); + + +#if !defined(__GNUC__) +#pragma endregion // power +#endif +// Intel 'ctlApi' for Device Adapter - Temperature Sensors +#if !defined(__GNUC__) +#pragma region temperature +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Temperature sensors +typedef enum _ctl_temp_sensors_t +{ + CTL_TEMP_SENSORS_GLOBAL = 0, ///< The maximum temperature across all device sensors + CTL_TEMP_SENSORS_GPU = 1, ///< The maximum temperature across all sensors in the GPU + CTL_TEMP_SENSORS_MEMORY = 2, ///< The maximum temperature across all sensors in the local memory + CTL_TEMP_SENSORS_GLOBAL_MIN = 3, ///< The minimum temperature across all device sensors + CTL_TEMP_SENSORS_GPU_MIN = 4, ///< The minimum temperature across all sensors in the GPU + CTL_TEMP_SENSORS_MEMORY_MIN = 5, ///< The minimum temperature across all sensors in the local device memory + CTL_TEMP_SENSORS_MAX + +} ctl_temp_sensors_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Temperature sensor properties +typedef struct _ctl_temp_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_temp_sensors_t type; ///< [out] Which part of the device the temperature sensor measures + double maxTemperature; ///< [out] Will contain the maximum temperature for the specific device in + ///< degrees Celsius. + +} ctl_temp_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of temperature sensors +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumTemperatureSensors( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get temperature sensor properties +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hTemperature` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlTemperatureGetProperties( + ctl_temp_handle_t hTemperature, ///< [in] Handle for the component. + ctl_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the temperature from a specified sensor +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hTemperature` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pTemperature` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlTemperatureGetState( + ctl_temp_handle_t hTemperature, ///< [in] Handle for the component. + double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor + ///< in degrees Celsius. + ); + + +#if !defined(__GNUC__) +#pragma endregion // temperature +#endif + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlInit +typedef ctl_result_t (CTL_APICALL *ctl_pfnInit_t)( + ctl_init_args_t*, + ctl_api_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlClose +typedef ctl_result_t (CTL_APICALL *ctl_pfnClose_t)( + ctl_api_handle_t + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlSetRuntimePath +typedef ctl_result_t (CTL_APICALL *ctl_pfnSetRuntimePath_t)( + ctl_runtime_path_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlWaitForPropertyChange +typedef ctl_result_t (CTL_APICALL *ctl_pfnWaitForPropertyChange_t)( + ctl_device_adapter_handle_t, + ctl_wait_property_change_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlReservedCall +typedef ctl_result_t (CTL_APICALL *ctl_pfnReservedCall_t)( + ctl_device_adapter_handle_t, + ctl_reserved_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSupported3DCapabilities +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSupported3DCapabilities_t)( + ctl_device_adapter_handle_t, + ctl_3d_feature_caps_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSet3DFeature +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSet3DFeature_t)( + ctl_device_adapter_handle_t, + ctl_3d_feature_getset_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlCheckDriverVersion +typedef ctl_result_t (CTL_APICALL *ctl_pfnCheckDriverVersion_t)( + ctl_device_adapter_handle_t, + ctl_version_info_t + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumerateDevices +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateDevices_t)( + ctl_api_handle_t, + uint32_t*, + ctl_device_adapter_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumerateDisplayOutputs +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateDisplayOutputs_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_display_output_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumerateI2CPinPairs +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateI2CPinPairs_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_i2c_pin_pair_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetDeviceProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetDeviceProperties_t)( + ctl_device_adapter_handle_t, + ctl_device_adapter_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetDisplayProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetDisplayProperties_t)( + ctl_display_output_handle_t, + ctl_display_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetAdaperDisplayEncoderProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetAdaperDisplayEncoderProperties_t)( + ctl_display_output_handle_t, + ctl_adapter_display_encoder_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetZeDevice +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetZeDevice_t)( + ctl_device_adapter_handle_t, + void*, + void** + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSharpnessCaps +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSharpnessCaps_t)( + ctl_display_output_handle_t, + ctl_sharpness_caps_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetCurrentSharpness +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetCurrentSharpness_t)( + ctl_display_output_handle_t, + ctl_sharpness_settings_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlSetCurrentSharpness +typedef ctl_result_t (CTL_APICALL *ctl_pfnSetCurrentSharpness_t)( + ctl_display_output_handle_t, + ctl_sharpness_settings_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlI2CAccess +typedef ctl_result_t (CTL_APICALL *ctl_pfnI2CAccess_t)( + ctl_display_output_handle_t, + ctl_i2c_access_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlI2CAccessOnPinPair +typedef ctl_result_t (CTL_APICALL *ctl_pfnI2CAccessOnPinPair_t)( + ctl_i2c_pin_pair_handle_t, + ctl_i2c_access_pinpair_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlAUXAccess +typedef ctl_result_t (CTL_APICALL *ctl_pfnAUXAccess_t)( + ctl_display_output_handle_t, + ctl_aux_access_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetPowerOptimizationCaps +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetPowerOptimizationCaps_t)( + ctl_display_output_handle_t, + ctl_power_optimization_caps_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetPowerOptimizationSetting +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetPowerOptimizationSetting_t)( + ctl_display_output_handle_t, + ctl_power_optimization_settings_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlSetPowerOptimizationSetting +typedef ctl_result_t (CTL_APICALL *ctl_pfnSetPowerOptimizationSetting_t)( + ctl_display_output_handle_t, + ctl_power_optimization_settings_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlSetBrightnessSetting +typedef ctl_result_t (CTL_APICALL *ctl_pfnSetBrightnessSetting_t)( + ctl_display_output_handle_t, + ctl_set_brightness_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetBrightnessSetting +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetBrightnessSetting_t)( + ctl_display_output_handle_t, + ctl_get_brightness_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPixelTransformationGetConfig +typedef ctl_result_t (CTL_APICALL *ctl_pfnPixelTransformationGetConfig_t)( + ctl_display_output_handle_t, + ctl_pixtx_pipe_get_config_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPixelTransformationSetConfig +typedef ctl_result_t (CTL_APICALL *ctl_pfnPixelTransformationSetConfig_t)( + ctl_display_output_handle_t, + ctl_pixtx_pipe_set_config_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPanelDescriptorAccess +typedef ctl_result_t (CTL_APICALL *ctl_pfnPanelDescriptorAccess_t)( + ctl_display_output_handle_t, + ctl_panel_descriptor_access_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSupportedRetroScalingCapability +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSupportedRetroScalingCapability_t)( + ctl_device_adapter_handle_t, + ctl_retro_scaling_caps_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetRetroScaling +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetRetroScaling_t)( + ctl_device_adapter_handle_t, + ctl_retro_scaling_settings_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSupportedScalingCapability +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSupportedScalingCapability_t)( + ctl_display_output_handle_t, + ctl_scaling_caps_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetCurrentScaling +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetCurrentScaling_t)( + ctl_display_output_handle_t, + ctl_scaling_settings_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlSetCurrentScaling +typedef ctl_result_t (CTL_APICALL *ctl_pfnSetCurrentScaling_t)( + ctl_display_output_handle_t, + ctl_scaling_settings_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetLACEConfig +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetLACEConfig_t)( + ctl_display_output_handle_t, + ctl_lace_config_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlSetLACEConfig +typedef ctl_result_t (CTL_APICALL *ctl_pfnSetLACEConfig_t)( + ctl_display_output_handle_t, + ctl_lace_config_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlSoftwarePSR +typedef ctl_result_t (CTL_APICALL *ctl_pfnSoftwarePSR_t)( + ctl_display_output_handle_t, + ctl_sw_psr_settings_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetIntelArcSyncInfoForMonitor +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetIntelArcSyncInfoForMonitor_t)( + ctl_display_output_handle_t, + ctl_intel_arc_sync_monitor_params_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumerateMuxDevices +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateMuxDevices_t)( + ctl_api_handle_t, + uint32_t*, + ctl_mux_output_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetMuxProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetMuxProperties_t)( + ctl_mux_output_handle_t, + ctl_mux_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlSwitchMux +typedef ctl_result_t (CTL_APICALL *ctl_pfnSwitchMux_t)( + ctl_mux_output_handle_t, + ctl_display_output_handle_t + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetIntelArcSyncProfile +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetIntelArcSyncProfile_t)( + ctl_display_output_handle_t, + ctl_intel_arc_sync_profile_params_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlSetIntelArcSyncProfile +typedef ctl_result_t (CTL_APICALL *ctl_pfnSetIntelArcSyncProfile_t)( + ctl_display_output_handle_t, + ctl_intel_arc_sync_profile_params_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEdidManagement +typedef ctl_result_t (CTL_APICALL *ctl_pfnEdidManagement_t)( + ctl_display_output_handle_t, + ctl_edid_management_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetCustomMode +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetCustomMode_t)( + ctl_display_output_handle_t, + ctl_get_set_custom_mode_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetCombinedDisplay +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetCombinedDisplay_t)( + ctl_device_adapter_handle_t, + ctl_combined_display_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetDisplayGenlock +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDisplayGenlock_t)( + ctl_device_adapter_handle_t*, + ctl_genlock_args_t*, + uint32_t, + ctl_device_adapter_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetVblankTimestamp +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetVblankTimestamp_t)( + ctl_display_output_handle_t, + ctl_vblank_ts_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlLinkDisplayAdapters +typedef ctl_result_t (CTL_APICALL *ctl_pfnLinkDisplayAdapters_t)( + ctl_device_adapter_handle_t, + ctl_lda_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlUnlinkDisplayAdapters +typedef ctl_result_t (CTL_APICALL *ctl_pfnUnlinkDisplayAdapters_t)( + ctl_device_adapter_handle_t + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetLinkedDisplayAdapters +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetLinkedDisplayAdapters_t)( + ctl_device_adapter_handle_t, + ctl_lda_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetDynamicContrastEnhancement +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDynamicContrastEnhancement_t)( + ctl_display_output_handle_t, + ctl_dce_args_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetWireFormat +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetWireFormat_t)( + ctl_display_output_handle_t, + ctl_get_set_wire_format_config_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetDisplaySettings +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDisplaySettings_t)( + ctl_display_output_handle_t, + ctl_display_settings_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumEngineGroups +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumEngineGroups_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_engine_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEngineGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnEngineGetProperties_t)( + ctl_engine_handle_t, + ctl_engine_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEngineGetActivity +typedef ctl_result_t (CTL_APICALL *ctl_pfnEngineGetActivity_t)( + ctl_engine_handle_t, + ctl_engine_stats_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumFans +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumFans_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_fan_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFanGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnFanGetProperties_t)( + ctl_fan_handle_t, + ctl_fan_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFanGetConfig +typedef ctl_result_t (CTL_APICALL *ctl_pfnFanGetConfig_t)( + ctl_fan_handle_t, + ctl_fan_config_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFanSetDefaultMode +typedef ctl_result_t (CTL_APICALL *ctl_pfnFanSetDefaultMode_t)( + ctl_fan_handle_t + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFanSetFixedSpeedMode +typedef ctl_result_t (CTL_APICALL *ctl_pfnFanSetFixedSpeedMode_t)( + ctl_fan_handle_t, + const ctl_fan_speed_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFanSetSpeedTableMode +typedef ctl_result_t (CTL_APICALL *ctl_pfnFanSetSpeedTableMode_t)( + ctl_fan_handle_t, + const ctl_fan_speed_table_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFanGetState +typedef ctl_result_t (CTL_APICALL *ctl_pfnFanGetState_t)( + ctl_fan_handle_t, + ctl_fan_speed_units_t, + int32_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumFrequencyDomains +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumFrequencyDomains_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_freq_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFrequencyGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetProperties_t)( + ctl_freq_handle_t, + ctl_freq_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFrequencyGetAvailableClocks +typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetAvailableClocks_t)( + ctl_freq_handle_t, + uint32_t*, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFrequencyGetRange +typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetRange_t)( + ctl_freq_handle_t, + ctl_freq_range_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFrequencySetRange +typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencySetRange_t)( + ctl_freq_handle_t, + const ctl_freq_range_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFrequencyGetState +typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetState_t)( + ctl_freq_handle_t, + ctl_freq_state_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlFrequencyGetThrottleTime +typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetThrottleTime_t)( + ctl_freq_handle_t, + ctl_freq_throttle_time_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSupportedVideoProcessingCapabilities +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSupportedVideoProcessingCapabilities_t)( + ctl_device_adapter_handle_t, + ctl_video_processing_feature_caps_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetSetVideoProcessingFeature +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetVideoProcessingFeature_t)( + ctl_device_adapter_handle_t, + ctl_video_processing_feature_getset_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumMemoryModules +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumMemoryModules_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_mem_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlMemoryGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnMemoryGetProperties_t)( + ctl_mem_handle_t, + ctl_mem_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlMemoryGetState +typedef ctl_result_t (CTL_APICALL *ctl_pfnMemoryGetState_t)( + ctl_mem_handle_t, + ctl_mem_state_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlMemoryGetBandwidth +typedef ctl_result_t (CTL_APICALL *ctl_pfnMemoryGetBandwidth_t)( + ctl_mem_handle_t, + ctl_mem_bandwidth_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGetProperties_t)( + ctl_device_adapter_handle_t, + ctl_oc_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockWaiverSet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockWaiverSet_t)( + ctl_device_adapter_handle_t + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuFrequencyOffsetGet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuFrequencyOffsetGet_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuFrequencyOffsetSet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuFrequencyOffsetSet_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuVoltageOffsetGet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuVoltageOffsetGet_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuVoltageOffsetSet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuVoltageOffsetSet_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuLockGet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuLockGet_t)( + ctl_device_adapter_handle_t, + ctl_oc_vf_pair_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuLockSet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuLockSet_t)( + ctl_device_adapter_handle_t, + ctl_oc_vf_pair_t + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockVramFrequencyOffsetGet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramFrequencyOffsetGet_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockVramFrequencyOffsetSet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramFrequencyOffsetSet_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockVramVoltageOffsetGet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramVoltageOffsetGet_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockVramVoltageOffsetSet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramVoltageOffsetSet_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockPowerLimitGet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockPowerLimitGet_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockPowerLimitSet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockPowerLimitSet_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockTemperatureLimitGet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockTemperatureLimitGet_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockTemperatureLimitSet +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockTemperatureLimitSet_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPowerTelemetryGet +typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerTelemetryGet_t)( + ctl_device_adapter_handle_t, + ctl_power_telemetry_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockResetToDefault +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockResetToDefault_t)( + ctl_device_adapter_handle_t + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPciGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnPciGetProperties_t)( + ctl_device_adapter_handle_t, + ctl_pci_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPciGetState +typedef ctl_result_t (CTL_APICALL *ctl_pfnPciGetState_t)( + ctl_device_adapter_handle_t, + ctl_pci_state_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumPowerDomains +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumPowerDomains_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_pwr_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPowerGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerGetProperties_t)( + ctl_pwr_handle_t, + ctl_power_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPowerGetEnergyCounter +typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerGetEnergyCounter_t)( + ctl_pwr_handle_t, + ctl_power_energy_counter_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPowerGetLimits +typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerGetLimits_t)( + ctl_pwr_handle_t, + ctl_power_limits_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlPowerSetLimits +typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerSetLimits_t)( + ctl_pwr_handle_t, + const ctl_power_limits_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumTemperatureSensors +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumTemperatureSensors_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_temp_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlTemperatureGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnTemperatureGetProperties_t)( + ctl_temp_handle_t, + ctl_temp_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlTemperatureGetState +typedef ctl_result_t (CTL_APICALL *ctl_pfnTemperatureGetState_t)( + ctl_temp_handle_t, + double* + ); + + +#if defined(__cplusplus) +} // extern "C" +#endif + +#endif // _CTL_API_H \ No newline at end of file diff --git a/include/cApiWrapper.cpp b/include/cApiWrapper.cpp new file mode 100644 index 0000000..9acdd38 --- /dev/null +++ b/include/cApiWrapper.cpp @@ -0,0 +1,4776 @@ +//=========================================================================== +//Copyright (C) 2022-23 Intel Corporation +// +// +// +//SPDX-License-Identifier: MIT +//-------------------------------------------------------------------------- + +/** + * + * @file ctl_api.cpp + * @version v1-r1 + * + */ + +// Note: UWP applications should have defined WINDOWS_UWP in their compiler settings +// Also at this point, it's easier by not enabling pre-compiled option to compile this file +// Not all functionalities are tested for a UWP application + +#include +#include + +//#define CTL_APIEXPORT + +#include "igcl_api.h" + +///////////////////////////////////////////////////////////////////////////////// +// +// Implementation of wrapper functions +// +static HINSTANCE hinstLib = NULL; +static ctl_runtime_path_args_t* pRuntimeArgs = NULL; + +HINSTANCE GetLoaderHandle(void) +{ + return hinstLib; +} + +/** + * @brief Function to get DLL name based on app version + * + */ + +#if defined(_WIN64) + #define CTL_DLL_NAME L"ControlLib" +#else + #define CTL_DLL_NAME L"ControlLib32" +#endif +#define CTL_DLL_PATH_LEN 512 + +ctl_result_t GetControlAPIDLLPath(ctl_init_args_t* pInitArgs, wchar_t* pwcDLLPath) +{ + if ((NULL == pRuntimeArgs) || (NULL == pRuntimeArgs->pRuntimePath)) + { + // Load the requested DLL based on major version in init args + uint16_t majorVersion = CTL_MAJOR_VERSION(pInitArgs->AppVersion); + + // If caller's major version is higher than the DLL's, then simply not support the caller! + // This is not supposed to happen as wrapper is part of the app itself which includes igcl_api.h with right major version + if (majorVersion > CTL_IMPL_MAJOR_VERSION) + return CTL_RESULT_ERROR_UNSUPPORTED_VERSION; + +#if (CTL_IMPL_MAJOR_VERSION > 1) + if (majorVersion > 1) + StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s%d.dll", CTL_DLL_NAME, majorVersion); + else // just control_api.dll + StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s.dll", CTL_DLL_NAME); +#else + StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s.dll", CTL_DLL_NAME); +#endif + + } + else if (pRuntimeArgs->pRuntimePath) + { + // caller specified a specific RT, use it instead + wcsncpy_s(pwcDLLPath, CTL_DLL_PATH_LEN, pRuntimeArgs->pRuntimePath, CTL_DLL_PATH_LEN - 1); + } + return CTL_RESULT_SUCCESS; +} + + + +/** +* @brief Control Api Init +* +* @details +* - Control Api Init +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pInitDesc` +* + `nullptr == phAPIHandle` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlInit( + ctl_init_args_t* pInitDesc, ///< [in][out] App's control API version + ctl_api_handle_t* phAPIHandle ///< [in][out][release] Control API handle + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + // special code - only for ctlInit() + if (NULL == hinstLib) + { + wchar_t strDLLPath[CTL_DLL_PATH_LEN]; + result = GetControlAPIDLLPath(pInitDesc, strDLLPath); + if (result == CTL_RESULT_SUCCESS) + { +#ifdef WINDOWS_UWP + hinstLib = LoadPackagedLibrary(strDLLPath, 0); +#else + DWORD dwFlags = LOAD_LIBRARY_SEARCH_SYSTEM32; +#ifdef _DEBUG + dwFlags = dwFlags | LOAD_LIBRARY_SEARCH_APPLICATION_DIR; +#endif + hinstLib = LoadLibraryExW(strDLLPath, NULL, dwFlags); +#endif + if (NULL == hinstLib) + { + result = CTL_RESULT_ERROR_LOAD; + } + else if (pRuntimeArgs) + { + ctlSetRuntimePath(pRuntimeArgs); + } + } + } + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnInit_t pfnInit = (ctl_pfnInit_t)GetProcAddress(hinstLibPtr, "ctlInit"); + if (pfnInit) + { + result = pfnInit(pInitDesc, phAPIHandle); + } + } + + return result; +} + + +/** +* @brief Control Api Destroy +* +* @details +* - Control Api Close +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hAPIHandle` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlClose( + ctl_api_handle_t hAPIHandle ///< [in][release] Control API implementation handle obtained during init + ///< call + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnClose_t pfnClose = (ctl_pfnClose_t)GetProcAddress(hinstLibPtr, "ctlClose"); + if (pfnClose) + { + result = pfnClose(hAPIHandle); + } + } + + // special code - only for ctlClose() + // might get CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER + // if its open by another caller do not free the instance handle + if( result == CTL_RESULT_SUCCESS) + { + if (NULL != hinstLib) + { + FreeLibrary(hinstLib); + hinstLib = NULL; + } + } + // set runtime args back to NULL + // no need to free this as it's allocated by caller + pRuntimeArgs = NULL; + return result; +} + + +/** +* @brief Runtime path +* +* @details +* - Control Api set runtime path. Optional call from a loader which allows +* the loaded runtime to enumerate only the adapters which the specified +* runtime is responsible for. This is done usually by a loader or by +* callers who know how to get the specific runtime of interest. This +* call right now is reserved for use by Intel components. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlSetRuntimePath( + ctl_runtime_path_args_t* pArgs ///< [in] Runtime path + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnSetRuntimePath_t pfnSetRuntimePath = (ctl_pfnSetRuntimePath_t)GetProcAddress(hinstLibPtr, "ctlSetRuntimePath"); + if (pfnSetRuntimePath) + { + result = pfnSetRuntimePath(pArgs); + } + } + + // special code - only for ctlSetRuntimePath() + // might get CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER + // if its open by another caller do not free the instance handle + else if (pArgs->pRuntimePath) + { + // this is a case where the caller app is interested in loading a RT directly + // IMPORTANT NOTE: Free pArgs and pArgs->pRuntimePath only after ctlInit() call + pRuntimeArgs = pArgs; + result = CTL_RESULT_SUCCESS; + } + return result; +} + + +/** +* @brief Wait for a property change. Note that this is a blocking call +* +* @details +* - Wait for a property change in display, 3d, media etc. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlWaitForPropertyChange( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + ctl_wait_property_change_args_t* pArgs ///< [in] Argument containing information about which property changes to + ///< listen for + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnWaitForPropertyChange_t pfnWaitForPropertyChange = (ctl_pfnWaitForPropertyChange_t)GetProcAddress(hinstLibPtr, "ctlWaitForPropertyChange"); + if (pfnWaitForPropertyChange) + { + result = pfnWaitForPropertyChange(hDeviceAdapter, pArgs); + } + } + + return result; +} + + +/** +* @brief Reserved function +* +* @details +* - Reserved function +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlReservedCall( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + ctl_reserved_args_t* pArgs ///< [in] Argument containing information + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnReservedCall_t pfnReservedCall = (ctl_pfnReservedCall_t)GetProcAddress(hinstLibPtr, "ctlReservedCall"); + if (pfnReservedCall) + { + result = pfnReservedCall(hDeviceAdapter, pArgs); + } + } + + return result; +} + + +/** +* @brief Get 3D capabilities +* +* @details +* - The application gets 3D properties +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pFeatureCaps` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetSupported3DCapabilities( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_3d_feature_caps_t* pFeatureCaps ///< [in,out][release] 3D properties + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSupported3DCapabilities_t pfnGetSupported3DCapabilities = (ctl_pfnGetSupported3DCapabilities_t)GetProcAddress(hinstLibPtr, "ctlGetSupported3DCapabilities"); + if (pfnGetSupported3DCapabilities) + { + result = pfnGetSupported3DCapabilities(hDAhandle, pFeatureCaps); + } + } + + return result; +} + + +/** +* @brief Get/Set 3D feature +* +* @details +* - 3D feature details +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pFeature` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetSet3DFeature( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_3d_feature_getset_t* pFeature ///< [in][release] 3D feature get/set parameter + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSet3DFeature_t pfnGetSet3DFeature = (ctl_pfnGetSet3DFeature_t)GetProcAddress(hinstLibPtr, "ctlGetSet3DFeature"); + if (pfnGetSet3DFeature) + { + result = pfnGetSet3DFeature(hDAhandle, pFeature); + } + } + + return result; +} + + +/** +* @brief Check Driver version +* +* @details +* - The application checks driver version +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlCheckDriverVersion( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + ctl_version_info_t version_info ///< [in][release] Driver version info + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnCheckDriverVersion_t pfnCheckDriverVersion = (ctl_pfnCheckDriverVersion_t)GetProcAddress(hinstLibPtr, "ctlCheckDriverVersion"); + if (pfnCheckDriverVersion) + { + result = pfnCheckDriverVersion(hDeviceAdapter, version_info); + } + } + + return result; +} + + +/** +* @brief Enumerate devices +* +* @details +* - The application enumerates all device adapters in the system +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hAPIHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlEnumerateDevices( + ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned + ///< by the CtlInit function + uint32_t* pCount, ///< [in,out][release] pointer to the number of device instances. If count + ///< is zero, then the api will update the value with the total + ///< number of drivers available. If count is non-zero, then the api will + ///< only retrieve the number of drivers. + ///< If count is larger than the number of drivers available, then the api + ///< will update the value with the correct number of drivers available. + ctl_device_adapter_handle_t* phDevices ///< [in,out][optional][release][range(0, *pCount)] array of driver + ///< instance handles + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumerateDevices_t pfnEnumerateDevices = (ctl_pfnEnumerateDevices_t)GetProcAddress(hinstLibPtr, "ctlEnumerateDevices"); + if (pfnEnumerateDevices) + { + result = pfnEnumerateDevices(hAPIHandle, pCount, phDevices); + } + } + + return result; +} + + +/** +* @brief Enumerate display outputs +* +* @details +* - Enumerates display output capabilities +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlEnumerateDisplayOutputs( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + uint32_t* pCount, ///< [in,out][release] pointer to the number of display output instances. + ///< If count is zero, then the api will update the value with the total + ///< number of outputs available. If count is non-zero, then the api will + ///< only retrieve the number of outputs. + ///< If count is larger than the number of drivers available, then the api + ///< will update the value with the correct number of drivers available. + ctl_display_output_handle_t* phDisplayOutputs ///< [in,out][optional][release][range(0, *pCount)] array of display output + ///< instance handles + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumerateDisplayOutputs_t pfnEnumerateDisplayOutputs = (ctl_pfnEnumerateDisplayOutputs_t)GetProcAddress(hinstLibPtr, "ctlEnumerateDisplayOutputs"); + if (pfnEnumerateDisplayOutputs) + { + result = pfnEnumerateDisplayOutputs(hDeviceAdapter, pCount, phDisplayOutputs); + } + } + + return result; +} + + +/** +* @brief Enumerate I2C Pin Pairs +* +* @details +* - Returns available list of I2C Pin-Pairs on a requested adapter +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "The incoming pointer pCount is null" +* - ::CTL_RESULT_ERROR_INVALID_SIZE - "The supplied Count is not equal to actual number of i2c pin-pair instances" +*/ +ctl_result_t CTL_APICALL +ctlEnumerateI2CPinPairs( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to device adapter + uint32_t* pCount, ///< [in,out][release] pointer to the number of i2c pin-pair instances. If + ///< count is zero, then the api will update the value with the total + ///< number of i2c pin-pair instances available. If count is non-zero and + ///< matches the avaialble number of pin-pairs, then the api will only + ///< return the avaialble number of i2c pin-pair instances in phI2cPinPairs. + ctl_i2c_pin_pair_handle_t* phI2cPinPairs ///< [out][optional][release][range(0, *pCount)] array of i2c pin pair + ///< instance handles. Need to be allocated by Caller when supplying the + ///< *pCount > 0. + ///< If Count is not equal to actual number of i2c pin-pair instances, it + ///< will return CTL_RESULT_ERROR_INVALID_SIZE. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumerateI2CPinPairs_t pfnEnumerateI2CPinPairs = (ctl_pfnEnumerateI2CPinPairs_t)GetProcAddress(hinstLibPtr, "ctlEnumerateI2CPinPairs"); + if (pfnEnumerateI2CPinPairs) + { + result = pfnEnumerateI2CPinPairs(hDeviceAdapter, pCount, phI2cPinPairs); + } + } + + return result; +} + + +/** +* @brief Get Device Properties +* +* @details +* - The application gets device properties +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetDeviceProperties( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to control device adapter + ctl_device_adapter_properties_t* pProperties ///< [in,out][release] Query result for device properties + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetDeviceProperties_t pfnGetDeviceProperties = (ctl_pfnGetDeviceProperties_t)GetProcAddress(hinstLibPtr, "ctlGetDeviceProperties"); + if (pfnGetDeviceProperties) + { + result = pfnGetDeviceProperties(hDAhandle, pProperties); + } + } + + return result; +} + + +/** +* @brief Get Display Properties +* +* @details +* - The application gets display properties +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetDisplayProperties( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_display_properties_t* pProperties ///< [in,out][release] Query result for display properties + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetDisplayProperties_t pfnGetDisplayProperties = (ctl_pfnGetDisplayProperties_t)GetProcAddress(hinstLibPtr, "ctlGetDisplayProperties"); + if (pfnGetDisplayProperties) + { + result = pfnGetDisplayProperties(hDisplayOutput, pProperties); + } + } + + return result; +} + + +/** +* @brief Get Adapter Display encoder Properties +* +* @details +* - The application gets the graphic adapters display encoder properties +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetAdaperDisplayEncoderProperties( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_adapter_display_encoder_properties_t* pProperties ///< [in,out][release] Query result for adapter display encoder properties + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetAdaperDisplayEncoderProperties_t pfnGetAdaperDisplayEncoderProperties = (ctl_pfnGetAdaperDisplayEncoderProperties_t)GetProcAddress(hinstLibPtr, "ctlGetAdaperDisplayEncoderProperties"); + if (pfnGetAdaperDisplayEncoderProperties) + { + result = pfnGetAdaperDisplayEncoderProperties(hDisplayOutput, pProperties); + } + } + + return result; +} + + +/** +* @brief Get Level0 Device handle +* +* @details +* - The application gets OneAPI Level0 Device handles +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pZeDevice` +* + `nullptr == hInstance` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetZeDevice( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + void* pZeDevice, ///< [out][release] ze_device handle + void** hInstance ///< [out][release] Module instance which caller can use to get export + ///< functions directly + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetZeDevice_t pfnGetZeDevice = (ctl_pfnGetZeDevice_t)GetProcAddress(hinstLibPtr, "ctlGetZeDevice"); + if (pfnGetZeDevice) + { + result = pfnGetZeDevice(hDAhandle, pZeDevice, hInstance); + } + } + + return result; +} + + +/** +* @brief Get Sharpness capability +* +* @details +* - Returns sharpness capability +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pSharpnessCaps` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetSharpnessCaps( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_sharpness_caps_t* pSharpnessCaps ///< [in,out][release] Query result for sharpness capability + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSharpnessCaps_t pfnGetSharpnessCaps = (ctl_pfnGetSharpnessCaps_t)GetProcAddress(hinstLibPtr, "ctlGetSharpnessCaps"); + if (pfnGetSharpnessCaps) + { + result = pfnGetSharpnessCaps(hDisplayOutput, pSharpnessCaps); + } + } + + return result; +} + + +/** +* @brief Get Sharpness setting +* +* @details +* - Returns current sharpness settings +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pSharpnessSettings` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetCurrentSharpness( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_sharpness_settings_t* pSharpnessSettings ///< [in,out][release] Query result for sharpness current settings + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetCurrentSharpness_t pfnGetCurrentSharpness = (ctl_pfnGetCurrentSharpness_t)GetProcAddress(hinstLibPtr, "ctlGetCurrentSharpness"); + if (pfnGetCurrentSharpness) + { + result = pfnGetCurrentSharpness(hDisplayOutput, pSharpnessSettings); + } + } + + return result; +} + + +/** +* @brief Set Sharpness setting +* +* @details +* - Set current sharpness settings +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pSharpnessSettings` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlSetCurrentSharpness( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_sharpness_settings_t* pSharpnessSettings ///< [in][release] Set sharpness current settings + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnSetCurrentSharpness_t pfnSetCurrentSharpness = (ctl_pfnSetCurrentSharpness_t)GetProcAddress(hinstLibPtr, "ctlSetCurrentSharpness"); + if (pfnSetCurrentSharpness) + { + result = pfnSetCurrentSharpness(hDisplayOutput, pSharpnessSettings); + } + } + + return result; +} + + +/** +* @brief I2C Access +* +* @details +* - Interface to access I2C using display handle as identifier. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pI2cAccessArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid I2C data size" +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +*/ +ctl_result_t CTL_APICALL +ctlI2CAccess( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_i2c_access_args_t* pI2cAccessArgs ///< [in,out] I2c access arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnI2CAccess_t pfnI2CAccess = (ctl_pfnI2CAccess_t)GetProcAddress(hinstLibPtr, "ctlI2CAccess"); + if (pfnI2CAccess) + { + result = pfnI2CAccess(hDisplayOutput, pI2cAccessArgs); + } + } + + return result; +} + + +/** +* @brief I2C Access On Pin Pair +* +* @details +* - Interface to access I2C using pin-pair handle as identifier. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hI2cPinPair` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pI2cAccessArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid I2C data size" +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid Args passed" +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" +* - ::CTL_RESULT_ERROR_EXTERNAL_DISPLAY_ATTACHED - "Write to Address not allowed when Display is connected" +*/ +ctl_result_t CTL_APICALL +ctlI2CAccessOnPinPair( + ctl_i2c_pin_pair_handle_t hI2cPinPair, ///< [in] Handle to I2C pin pair. + ctl_i2c_access_pinpair_args_t* pI2cAccessArgs ///< [in,out] I2c access arguments. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnI2CAccessOnPinPair_t pfnI2CAccessOnPinPair = (ctl_pfnI2CAccessOnPinPair_t)GetProcAddress(hinstLibPtr, "ctlI2CAccessOnPinPair"); + if (pfnI2CAccessOnPinPair) + { + result = pfnI2CAccessOnPinPair(hI2cPinPair, pI2cAccessArgs); + } + } + + return result; +} + + +/** +* @brief Aux Access +* +* @details +* - The application does Aux access, PSR needs to be disabled for AUX +* call. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pAuxAccessArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid AUX data size" +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_INVALID_AUX_ACCESS_FLAG - "Invalid flag for AUX access" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +*/ +ctl_result_t CTL_APICALL +ctlAUXAccess( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_aux_access_args_t* pAuxAccessArgs ///< [in,out] Aux access arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnAUXAccess_t pfnAUXAccess = (ctl_pfnAUXAccess_t)GetProcAddress(hinstLibPtr, "ctlAUXAccess"); + if (pfnAUXAccess) + { + result = pfnAUXAccess(hDisplayOutput, pAuxAccessArgs); + } + } + + return result; +} + + +/** +* @brief Get Power optimization features +* +* @details +* - Returns power optimization capabilities +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pPowerOptimizationCaps` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetPowerOptimizationCaps( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_power_optimization_caps_t* pPowerOptimizationCaps ///< [in,out][release] Query result for power optimization features + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetPowerOptimizationCaps_t pfnGetPowerOptimizationCaps = (ctl_pfnGetPowerOptimizationCaps_t)GetProcAddress(hinstLibPtr, "ctlGetPowerOptimizationCaps"); + if (pfnGetPowerOptimizationCaps) + { + result = pfnGetPowerOptimizationCaps(hDisplayOutput, pPowerOptimizationCaps); + } + } + + return result; +} + + +/** +* @brief Get Power optimization setting +* +* @details +* - Returns power optimization setting for a specific feature +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pPowerOptimizationSettings` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG - "Unsupported PowerOptimizationFeature" +* - ::CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST - "DPST is supported only in DC Mode" +*/ +ctl_result_t CTL_APICALL +ctlGetPowerOptimizationSetting( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_power_optimization_settings_t* pPowerOptimizationSettings ///< [in,out][release] Power optimization data to be fetched + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetPowerOptimizationSetting_t pfnGetPowerOptimizationSetting = (ctl_pfnGetPowerOptimizationSetting_t)GetProcAddress(hinstLibPtr, "ctlGetPowerOptimizationSetting"); + if (pfnGetPowerOptimizationSetting) + { + result = pfnGetPowerOptimizationSetting(hDisplayOutput, pPowerOptimizationSettings); + } + } + + return result; +} + + +/** +* @brief Set Power optimization setting +* +* @details +* - Set power optimization setting for a specific feature +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pPowerOptimizationSettings` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG - "Unsupported PowerOptimizationFeature" +* - ::CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST - "DPST is supported only in DC Mode" +* - ::CTL_RESULT_ERROR_SET_FBC_FEATURE_NOT_SUPPORTED - "Set FBC Feature not supported" +*/ +ctl_result_t CTL_APICALL +ctlSetPowerOptimizationSetting( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_power_optimization_settings_t* pPowerOptimizationSettings ///< [in][release] Power optimization data to be applied + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnSetPowerOptimizationSetting_t pfnSetPowerOptimizationSetting = (ctl_pfnSetPowerOptimizationSetting_t)GetProcAddress(hinstLibPtr, "ctlSetPowerOptimizationSetting"); + if (pfnSetPowerOptimizationSetting) + { + result = pfnSetPowerOptimizationSetting(hDisplayOutput, pPowerOptimizationSettings); + } + } + + return result; +} + + +/** +* @brief Set Brightness on companion display +* +* @details +* - Set Brightness for a target display. Currently support is only for +* companion display. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pSetBrightnessSetting` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid Brightness data passed as argument" +* - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Currently Brightness API is supported only on companion display" +*/ +ctl_result_t CTL_APICALL +ctlSetBrightnessSetting( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_set_brightness_t* pSetBrightnessSetting ///< [in][release] Brightness settings to be applied + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnSetBrightnessSetting_t pfnSetBrightnessSetting = (ctl_pfnSetBrightnessSetting_t)GetProcAddress(hinstLibPtr, "ctlSetBrightnessSetting"); + if (pfnSetBrightnessSetting) + { + result = pfnSetBrightnessSetting(hDisplayOutput, pSetBrightnessSetting); + } + } + + return result; +} + + +/** +* @brief Get Brightness setting +* +* @details +* - Get Brightness for a target display. Currently support is only for +* companion display. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pGetBrightnessSetting` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Currently Brightness API is supported only on companion display" +*/ +ctl_result_t CTL_APICALL +ctlGetBrightnessSetting( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_get_brightness_t* pGetBrightnessSetting ///< [out][release] Brightness settings data to be fetched + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetBrightnessSetting_t pfnGetBrightnessSetting = (ctl_pfnGetBrightnessSetting_t)GetProcAddress(hinstLibPtr, "ctlGetBrightnessSetting"); + if (pfnGetBrightnessSetting) + { + result = pfnGetBrightnessSetting(hDisplayOutput, pGetBrightnessSetting); + } + } + + return result; +} + + +/** +* @brief Pixel transformation get pipe configuration +* +* @details +* - The application does pixel transformation get pipe configuration +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pPixTxGetConfigArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +* - ::CTL_RESULT_ERROR_INVALID_PIXTX_GET_CONFIG_QUERY_TYPE - "Invalid query type" +* - ::CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID - "Invalid block id" +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PIXTX_BLOCK_CONFIG_MEMORY - "Insufficient memery allocated for BlockConfigs" +* - ::CTL_RESULT_ERROR_3DLUT_INVALID_PIPE - "Invalid pipe for 3dlut" +* - ::CTL_RESULT_ERROR_3DLUT_INVALID_DATA - "Invalid 3dlut data" +* - ::CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR - "3dlut not supported in HDR" +* - ::CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION - "Invalid 3dlut operation" +* - ::CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL - "3dlut call unsuccessful" +*/ +ctl_result_t CTL_APICALL +ctlPixelTransformationGetConfig( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_pixtx_pipe_get_config_t* pPixTxGetConfigArgs///< [in,out] Pixel transformation get pipe configiguration arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPixelTransformationGetConfig_t pfnPixelTransformationGetConfig = (ctl_pfnPixelTransformationGetConfig_t)GetProcAddress(hinstLibPtr, "ctlPixelTransformationGetConfig"); + if (pfnPixelTransformationGetConfig) + { + result = pfnPixelTransformationGetConfig(hDisplayOutput, pPixTxGetConfigArgs); + } + } + + return result; +} + + +/** +* @brief Pixel transformation set pipe configuration +* +* @details +* - The application does pixel transformation set pipe configuration +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pPixTxSetConfigArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +* - ::CTL_RESULT_ERROR_INVALID_PIXTX_SET_CONFIG_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INVALID_SET_CONFIG_NUMBER_OF_SAMPLES - "Invalid number of samples" +* - ::CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID - "Invalid block id" +* - ::CTL_RESULT_ERROR_PERSISTANCE_NOT_SUPPORTED - "Persistance not supported" +* - ::CTL_RESULT_ERROR_3DLUT_INVALID_PIPE - "Invalid pipe for 3dlut" +* - ::CTL_RESULT_ERROR_3DLUT_INVALID_DATA - "Invalid 3dlut data" +* - ::CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR - "3dlut not supported in HDR" +* - ::CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION - "Invalid 3dlut operation" +* - ::CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL - "3dlut call unsuccessful" +*/ +ctl_result_t CTL_APICALL +ctlPixelTransformationSetConfig( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_pixtx_pipe_set_config_t* pPixTxSetConfigArgs///< [in,out] Pixel transformation set pipe configiguration arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPixelTransformationSetConfig_t pfnPixelTransformationSetConfig = (ctl_pfnPixelTransformationSetConfig_t)GetProcAddress(hinstLibPtr, "ctlPixelTransformationSetConfig"); + if (pfnPixelTransformationSetConfig) + { + result = pfnPixelTransformationSetConfig(hDisplayOutput, pPixTxSetConfigArgs); + } + } + + return result; +} + + +/** +* @brief Panel Descriptor Access +* +* @details +* - The application does EDID or Display ID access +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pPanelDescriptorAccessArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +*/ +ctl_result_t CTL_APICALL +ctlPanelDescriptorAccess( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_panel_descriptor_access_args_t* pPanelDescriptorAccessArgs ///< [in,out] Panel descriptor access arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPanelDescriptorAccess_t pfnPanelDescriptorAccess = (ctl_pfnPanelDescriptorAccess_t)GetProcAddress(hinstLibPtr, "ctlPanelDescriptorAccess"); + if (pfnPanelDescriptorAccess) + { + result = pfnPanelDescriptorAccess(hDisplayOutput, pPanelDescriptorAccessArgs); + } + } + + return result; +} + + +/** +* @brief Get Supported Retro Scaling Types +* +* @details +* - Returns supported retro scaling capabilities +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pRetroScalingCaps` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetSupportedRetroScalingCapability( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter + ctl_retro_scaling_caps_t* pRetroScalingCaps ///< [in,out][release] Query result for supported retro scaling types + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSupportedRetroScalingCapability_t pfnGetSupportedRetroScalingCapability = (ctl_pfnGetSupportedRetroScalingCapability_t)GetProcAddress(hinstLibPtr, "ctlGetSupportedRetroScalingCapability"); + if (pfnGetSupportedRetroScalingCapability) + { + result = pfnGetSupportedRetroScalingCapability(hDAhandle, pRetroScalingCaps); + } + } + + return result; +} + + +/** +* @brief Get/Set Retro Scaling +* +* @details +* - Get or Set the status of retro scaling.This Api will do a physical +* modeset resulting in flash on the screen +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pGetSetRetroScalingType` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetSetRetroScaling( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter + ctl_retro_scaling_settings_t* pGetSetRetroScalingType ///< [in,out][release] Get or Set the retro scaling type + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSetRetroScaling_t pfnGetSetRetroScaling = (ctl_pfnGetSetRetroScaling_t)GetProcAddress(hinstLibPtr, "ctlGetSetRetroScaling"); + if (pfnGetSetRetroScaling) + { + result = pfnGetSetRetroScaling(hDAhandle, pGetSetRetroScalingType); + } + } + + return result; +} + + +/** +* @brief Get Supported Scaling Types +* +* @details +* - Returns supported scaling capabilities +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pScalingCaps` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetSupportedScalingCapability( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_scaling_caps_t* pScalingCaps ///< [in,out][release] Query result for supported scaling types + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSupportedScalingCapability_t pfnGetSupportedScalingCapability = (ctl_pfnGetSupportedScalingCapability_t)GetProcAddress(hinstLibPtr, "ctlGetSupportedScalingCapability"); + if (pfnGetSupportedScalingCapability) + { + result = pfnGetSupportedScalingCapability(hDisplayOutput, pScalingCaps); + } + } + + return result; +} + + +/** +* @brief Get Current Scaling +* +* @details +* - Returns current active scaling +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pGetCurrentScalingType` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetCurrentScaling( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_scaling_settings_t* pGetCurrentScalingType ///< [in,out][release] Query result for active scaling types + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetCurrentScaling_t pfnGetCurrentScaling = (ctl_pfnGetCurrentScaling_t)GetProcAddress(hinstLibPtr, "ctlGetCurrentScaling"); + if (pfnGetCurrentScaling) + { + result = pfnGetCurrentScaling(hDisplayOutput, pGetCurrentScalingType); + } + } + + return result; +} + + +/** +* @brief Set Scaling Type +* +* @details +* - Returns current active scaling +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pSetScalingType` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlSetCurrentScaling( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_scaling_settings_t* pSetScalingType ///< [in,out][release] Set scaling types + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnSetCurrentScaling_t pfnSetCurrentScaling = (ctl_pfnSetCurrentScaling_t)GetProcAddress(hinstLibPtr, "ctlSetCurrentScaling"); + if (pfnSetCurrentScaling) + { + result = pfnSetCurrentScaling(hDisplayOutput, pSetScalingType); + } + } + + return result; +} + + +/** +* @brief Get LACE Config +* +* @details +* - Returns current LACE Config +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pLaceConfig` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED - "Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data passed by user" +*/ +ctl_result_t CTL_APICALL +ctlGetLACEConfig( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_lace_config_t* pLaceConfig ///< [out]Lace configuration + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetLACEConfig_t pfnGetLACEConfig = (ctl_pfnGetLACEConfig_t)GetProcAddress(hinstLibPtr, "ctlGetLACEConfig"); + if (pfnGetLACEConfig) + { + result = pfnGetLACEConfig(hDisplayOutput, pLaceConfig); + } + } + + return result; +} + + +/** +* @brief Sets LACE Config +* +* @details +* - Sets LACE Config +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pLaceConfig` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED - "Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data passed by user" +*/ +ctl_result_t CTL_APICALL +ctlSetLACEConfig( + ctl_display_output_handle_t hDisplayOutput, ///< [in]Handle to display output + ctl_lace_config_t* pLaceConfig ///< [in]Lace configuration + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnSetLACEConfig_t pfnSetLACEConfig = (ctl_pfnSetLACEConfig_t)GetProcAddress(hinstLibPtr, "ctlSetLACEConfig"); + if (pfnSetLACEConfig) + { + result = pfnSetLACEConfig(hDisplayOutput, pLaceConfig); + } + } + + return result; +} + + +/** +* @brief Get Software PSR caps/Set software PSR State +* +* @details +* - Returns Software PSR status or Sets Software PSR capabilities. This is +* a reserved capability. By default, software PSR is not supported/will +* not be enabled, need application to activate it, please contact Intel +* for activation. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pSoftwarePsrSetting` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlSoftwarePSR( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_sw_psr_settings_t* pSoftwarePsrSetting ///< [in,out][release] Get Software PSR caps/state or Set Software PSR + ///< state + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnSoftwarePSR_t pfnSoftwarePSR = (ctl_pfnSoftwarePSR_t)GetProcAddress(hinstLibPtr, "ctlSoftwarePSR"); + if (pfnSoftwarePSR) + { + result = pfnSoftwarePSR(hDisplayOutput, pSoftwarePsrSetting); + } + } + + return result; +} + + +/** +* @brief Get Intel Arc Sync information for monitor +* +* @details +* - Returns Intel Arc Sync information for selected monitor +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pIntelArcSyncMonitorParams` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetIntelArcSyncInfoForMonitor( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_intel_arc_sync_monitor_params_t* pIntelArcSyncMonitorParams ///< [in,out][release] Intel Arc Sync params for monitor + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetIntelArcSyncInfoForMonitor_t pfnGetIntelArcSyncInfoForMonitor = (ctl_pfnGetIntelArcSyncInfoForMonitor_t)GetProcAddress(hinstLibPtr, "ctlGetIntelArcSyncInfoForMonitor"); + if (pfnGetIntelArcSyncInfoForMonitor) + { + result = pfnGetIntelArcSyncInfoForMonitor(hDisplayOutput, pIntelArcSyncMonitorParams); + } + } + + return result; +} + + +/** +* @brief Enumerate Display MUX Devices on this system across adapters +* +* @details +* - The application enumerates all MUX devices in the system +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hAPIHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +* + `nullptr == phMuxDevices` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlEnumerateMuxDevices( + ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned + ///< by the CtlInit function + uint32_t* pCount, ///< [in,out][release] pointer to the number of MUX device instances. If + ///< input count is zero, then the api will update the value with the total + ///< number of MUX devices available and return the Count value. If input + ///< count is non-zero, then the api will only retrieve the number of MUX Devices. + ///< If count is larger than the number of MUX devices available, then the + ///< api will update the value with the correct number of MUX devices available. + ctl_mux_output_handle_t* phMuxDevices ///< [out][range(0, *pCount)] array of MUX device instance handles + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumerateMuxDevices_t pfnEnumerateMuxDevices = (ctl_pfnEnumerateMuxDevices_t)GetProcAddress(hinstLibPtr, "ctlEnumerateMuxDevices"); + if (pfnEnumerateMuxDevices) + { + result = pfnEnumerateMuxDevices(hAPIHandle, pCount, phMuxDevices); + } + } + + return result; +} + + +/** +* @brief Get Display Mux properties +* +* @details +* - Get the propeties of the Mux device +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hMuxDevice` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pMuxProperties` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetMuxProperties( + ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle + ctl_mux_properties_t* pMuxProperties ///< [in,out] MUX device properties + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetMuxProperties_t pfnGetMuxProperties = (ctl_pfnGetMuxProperties_t)GetProcAddress(hinstLibPtr, "ctlGetMuxProperties"); + if (pfnGetMuxProperties) + { + result = pfnGetMuxProperties(hMuxDevice, pMuxProperties); + } + } + + return result; +} + + +/** +* @brief Switch Mux output +* +* @details +* - Switches the MUX output +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hMuxDevice` +* + `nullptr == hInactiveDisplayOutput` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlSwitchMux( + ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle + ctl_display_output_handle_t hInactiveDisplayOutput ///< [out] Input selection for this MUX, which if active will drive the + ///< output of this MUX device. This should be one of the display output + ///< handles reported under this MUX device's properties. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnSwitchMux_t pfnSwitchMux = (ctl_pfnSwitchMux_t)GetProcAddress(hinstLibPtr, "ctlSwitchMux"); + if (pfnSwitchMux) + { + result = pfnSwitchMux(hMuxDevice, hInactiveDisplayOutput); + } + } + + return result; +} + + +/** +* @brief Get Intel Arc Sync profile +* +* @details +* - Returns Intel Arc Sync profile for selected monitor +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pIntelArcSyncProfileParams` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetIntelArcSyncProfile( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_intel_arc_sync_profile_params_t* pIntelArcSyncProfileParams ///< [in,out][release] Intel Arc Sync params for monitor + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetIntelArcSyncProfile_t pfnGetIntelArcSyncProfile = (ctl_pfnGetIntelArcSyncProfile_t)GetProcAddress(hinstLibPtr, "ctlGetIntelArcSyncProfile"); + if (pfnGetIntelArcSyncProfile) + { + result = pfnGetIntelArcSyncProfile(hDisplayOutput, pIntelArcSyncProfileParams); + } + } + + return result; +} + + +/** +* @brief Set Intel Arc Sync profile +* +* @details +* - Sets Intel Arc Sync profile for selected monitor. In a mux situation, +* this API should be called for all display IDs associated with a +* physical display. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pIntelArcSyncProfileParams` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlSetIntelArcSyncProfile( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_intel_arc_sync_profile_params_t* pIntelArcSyncProfileParams ///< [in][release] Intel Arc Sync params for monitor + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnSetIntelArcSyncProfile_t pfnSetIntelArcSyncProfile = (ctl_pfnSetIntelArcSyncProfile_t)GetProcAddress(hinstLibPtr, "ctlSetIntelArcSyncProfile"); + if (pfnSetIntelArcSyncProfile) + { + result = pfnSetIntelArcSyncProfile(hDisplayOutput, pIntelArcSyncProfileParams); + } + } + + return result; +} + + +/** +* @brief EDID Management allows managing an output's EDID or Plugged Status. +* +* @details +* - To manage output's EDID or Display ID. Supports native DP SST and HDMI +* Display types. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pEdidManagementArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +* - ::CTL_RESULT_ERROR_DISPLAY_NOT_ATTACHED - "Error for Output Device not attached" +* - ::CTL_RESULT_ERROR_OUT_OF_DEVICE_MEMORY - "Insufficient device memory to satisfy call" +* - ::CTL_RESULT_ERROR_DATA_NOT_FOUND - "Requested EDID data not present." +*/ +ctl_result_t CTL_APICALL +ctlEdidManagement( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_edid_management_args_t* pEdidManagementArgs ///< [in,out] EDID management arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEdidManagement_t pfnEdidManagement = (ctl_pfnEdidManagement_t)GetProcAddress(hinstLibPtr, "ctlEdidManagement"); + if (pfnEdidManagement) + { + result = pfnEdidManagement(hDisplayOutput, pEdidManagementArgs); + } + } + + return result; +} + + +/** +* @brief Get/Set Custom mode. +* +* @details +* - To get or set custom mode. +* - Add custom source mode operation supports only single mode additon at +* a time. +* - Remove custom source mode operation supports single or multiple mode +* removal at a time. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCustomModeArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +* - ::CTL_RESULT_ERROR_CUSTOM_MODE_STANDARD_CUSTOM_MODE_EXISTS - "Standard custom mode exists" +* - ::CTL_RESULT_ERROR_CUSTOM_MODE_NON_CUSTOM_MATCHING_MODE_EXISTS - "Non custom matching mode exists" +* - ::CTL_RESULT_ERROR_CUSTOM_MODE_INSUFFICIENT_MEMORY - "Custom mode insufficent memory" +*/ +ctl_result_t CTL_APICALL +ctlGetSetCustomMode( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_get_set_custom_mode_args_t* pCustomModeArgs ///< [in,out] Custom mode arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSetCustomMode_t pfnGetSetCustomMode = (ctl_pfnGetSetCustomMode_t)GetProcAddress(hinstLibPtr, "ctlGetSetCustomMode"); + if (pfnGetSetCustomMode) + { + result = pfnGetSetCustomMode(hDisplayOutput, pCustomModeArgs); + } + } + + return result; +} + + +/** +* @brief Get/Set Combined Display +* +* @details +* - To get or set combined display with given Child Targets on a Single +* GPU or across identical GPUs. Multi-GPU(MGPU) combined display is +* reserved i.e. it is not public and requires special application GUID. +* MGPU Combined Display will get activated or deactivated in next boot. +* MGPU scenario will internally link the associated adapters via Linked +* Display Adapter Call, with supplied hDeviceAdapter being the LDA +* Primary. If Genlock and enabled in Driver registry and supported by +* given Display Config, MGPU Combined Display will enable MGPU Genlock +* with supplied hDeviceAdapter being the Genlock Primary Adapter and the +* First Child Display being the Primary Display. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCombinedDisplayArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +* - ::CTL_RESULT_ERROR_FEATURE_NOT_SUPPORTED - "Combined Display feature is not supported in this platform" +* - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" +*/ +ctl_result_t CTL_APICALL +ctlGetSetCombinedDisplay( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] Handle to control device adapter + ctl_combined_display_args_t* pCombinedDisplayArgs ///< [in,out] Setup and get combined display arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSetCombinedDisplay_t pfnGetSetCombinedDisplay = (ctl_pfnGetSetCombinedDisplay_t)GetProcAddress(hinstLibPtr, "ctlGetSetCombinedDisplay"); + if (pfnGetSetCombinedDisplay) + { + result = pfnGetSetCombinedDisplay(hDeviceAdapter, pCombinedDisplayArgs); + } + } + + return result; +} + + +/** +* @brief Get/Set Display Genlock +* +* @details +* - To get or set Display Genlock. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == hDeviceAdapter` +* + `nullptr == pGenlockArgs` +* + `nullptr == hFailureDeviceAdapter` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid topology structure size" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +*/ +ctl_result_t CTL_APICALL +ctlGetSetDisplayGenlock( + ctl_device_adapter_handle_t* hDeviceAdapter, ///< [in][release] Handle to control device adapter + ctl_genlock_args_t* pGenlockArgs, ///< [in,out] Display Genlock operation and information + uint32_t AdapterCount, ///< [in] Number of device adapters + ctl_device_adapter_handle_t* hFailureDeviceAdapter ///< [out] Handle to address the failure device adapter in an error case + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSetDisplayGenlock_t pfnGetSetDisplayGenlock = (ctl_pfnGetSetDisplayGenlock_t)GetProcAddress(hinstLibPtr, "ctlGetSetDisplayGenlock"); + if (pfnGetSetDisplayGenlock) + { + result = pfnGetSetDisplayGenlock(hDeviceAdapter, pGenlockArgs, AdapterCount, hFailureDeviceAdapter); + } + } + + return result; +} + + +/** +* @brief Get Vblank Timestamp +* +* @details +* - To get a list of vblank timestamps in microseconds for each child +* target of a display. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pVblankTSArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +*/ +ctl_result_t CTL_APICALL +ctlGetVblankTimestamp( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_vblank_ts_args_t* pVblankTSArgs ///< [out] Get vblank timestamp arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetVblankTimestamp_t pfnGetVblankTimestamp = (ctl_pfnGetVblankTimestamp_t)GetProcAddress(hinstLibPtr, "ctlGetVblankTimestamp"); + if (pfnGetVblankTimestamp) + { + result = pfnGetVblankTimestamp(hDisplayOutput, pVblankTSArgs); + } + } + + return result; +} + + +/** +* @brief Link Display Adapters +* +* @details +* - To Link Display Adapters. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hPrimaryAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pLdaArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +* - ::CTL_RESULT_ERROR_ADAPTER_ALREADY_LINKED - "Adapter is already linked" +*/ +ctl_result_t CTL_APICALL +ctlLinkDisplayAdapters( + ctl_device_adapter_handle_t hPrimaryAdapter, ///< [in][release] Handle to Primary adapter in LDA chain + ctl_lda_args_t* pLdaArgs ///< [in] Link Display Adapters Arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnLinkDisplayAdapters_t pfnLinkDisplayAdapters = (ctl_pfnLinkDisplayAdapters_t)GetProcAddress(hinstLibPtr, "ctlLinkDisplayAdapters"); + if (pfnLinkDisplayAdapters) + { + result = pfnLinkDisplayAdapters(hPrimaryAdapter, pLdaArgs); + } + } + + return result; +} + + +/** +* @brief Unlink Display Adapters +* +* @details +* - To Unlink Display Adapters +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hPrimaryAdapter` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +* - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" +*/ +ctl_result_t CTL_APICALL +ctlUnlinkDisplayAdapters( + ctl_device_adapter_handle_t hPrimaryAdapter ///< [in][release] Handle to Primary adapter in LDA chain + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnUnlinkDisplayAdapters_t pfnUnlinkDisplayAdapters = (ctl_pfnUnlinkDisplayAdapters_t)GetProcAddress(hinstLibPtr, "ctlUnlinkDisplayAdapters"); + if (pfnUnlinkDisplayAdapters) + { + result = pfnUnlinkDisplayAdapters(hPrimaryAdapter); + } + } + + return result; +} + + +/** +* @brief Get Linked Display Adapters +* +* @details +* - To return list of Linked Display Adapters. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hPrimaryAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pLdaArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +* - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" +*/ +ctl_result_t CTL_APICALL +ctlGetLinkedDisplayAdapters( + ctl_device_adapter_handle_t hPrimaryAdapter, ///< [in][release] Handle to Primary adapter in LDA chain + ctl_lda_args_t* pLdaArgs ///< [out] Link Display Adapters Arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetLinkedDisplayAdapters_t pfnGetLinkedDisplayAdapters = (ctl_pfnGetLinkedDisplayAdapters_t)GetProcAddress(hinstLibPtr, "ctlGetLinkedDisplayAdapters"); + if (pfnGetLinkedDisplayAdapters) + { + result = pfnGetLinkedDisplayAdapters(hPrimaryAdapter, pLdaArgs); + } + } + + return result; +} + + +/** +* @brief Get/Set Dynamic Contrast Enhancement +* +* @details +* - To get the DCE feature status and, if feature is enabled, returns the +* current histogram, or to set the brightness at the phase-in speed +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pDceArgs` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +*/ +ctl_result_t CTL_APICALL +ctlGetSetDynamicContrastEnhancement( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_dce_args_t* pDceArgs ///< [in,out] Dynamic Contrast Enhancement arguments + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSetDynamicContrastEnhancement_t pfnGetSetDynamicContrastEnhancement = (ctl_pfnGetSetDynamicContrastEnhancement_t)GetProcAddress(hinstLibPtr, "ctlGetSetDynamicContrastEnhancement"); + if (pfnGetSetDynamicContrastEnhancement) + { + result = pfnGetSetDynamicContrastEnhancement(hDisplayOutput, pDceArgs); + } + } + + return result; +} + + +/** +* @brief Get/Set Color Format and Color Depth +* +* @details +* - Get and Set the Color Format and Color Depth of a target +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pGetSetWireFormatSetting` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid data passed as argument, WireFormat is not supported" +* - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +*/ +ctl_result_t CTL_APICALL +ctlGetSetWireFormat( + ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output + ctl_get_set_wire_format_config_t* pGetSetWireFormatSetting ///< [in][release] Get/Set Wire Format settings to be fetched/applied + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSetWireFormat_t pfnGetSetWireFormat = (ctl_pfnGetSetWireFormat_t)GetProcAddress(hinstLibPtr, "ctlGetSetWireFormat"); + if (pfnGetSetWireFormat) + { + result = pfnGetSetWireFormat(hDisplayOutput, pGetSetWireFormatSetting); + } + } + + return result; +} + + +/** +* @brief Get/Set Display settings +* +* @details +* - To get/set end display settings like low latency, HDR10+ signaling +* etc. which are controlled via info-frames/secondary data packets +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDisplayOutput` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pDisplaySettings` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" +* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" +* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" +* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" +* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" +* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" +*/ +ctl_result_t CTL_APICALL +ctlGetSetDisplaySettings( + ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output + ctl_display_settings_t* pDisplaySettings ///< [in,out] End display capabilities + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSetDisplaySettings_t pfnGetSetDisplaySettings = (ctl_pfnGetSetDisplaySettings_t)GetProcAddress(hinstLibPtr, "ctlGetSetDisplaySettings"); + if (pfnGetSetDisplaySettings) + { + result = pfnGetSetDisplaySettings(hDisplayOutput, pDisplaySettings); + } + } + + return result; +} + + +/** +* @brief Get handle of engine groups +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +*/ +ctl_result_t CTL_APICALL +ctlEnumEngineGroups( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumEngineGroups_t pfnEnumEngineGroups = (ctl_pfnEnumEngineGroups_t)GetProcAddress(hinstLibPtr, "ctlEnumEngineGroups"); + if (pfnEnumEngineGroups) + { + result = pfnEnumEngineGroups(hDAhandle, pCount, phEngine); + } + } + + return result; +} + + +/** +* @brief Get engine group properties +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hEngine` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +*/ +ctl_result_t CTL_APICALL +ctlEngineGetProperties( + ctl_engine_handle_t hEngine, ///< [in] Handle for the component. + ctl_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEngineGetProperties_t pfnEngineGetProperties = (ctl_pfnEngineGetProperties_t)GetProcAddress(hinstLibPtr, "ctlEngineGetProperties"); + if (pfnEngineGetProperties) + { + result = pfnEngineGetProperties(hEngine, pProperties); + } + } + + return result; +} + + +/** +* @brief Get the activity stats for an engine group +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hEngine` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pStats` +*/ +ctl_result_t CTL_APICALL +ctlEngineGetActivity( + ctl_engine_handle_t hEngine, ///< [in] Handle for the component. + ctl_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity + ///< counters. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEngineGetActivity_t pfnEngineGetActivity = (ctl_pfnEngineGetActivity_t)GetProcAddress(hinstLibPtr, "ctlEngineGetActivity"); + if (pfnEngineGetActivity) + { + result = pfnEngineGetActivity(hEngine, pStats); + } + } + + return result; +} + + +/** +* @brief Get handle of fans +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +*/ +ctl_result_t CTL_APICALL +ctlEnumFans( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to the adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumFans_t pfnEnumFans = (ctl_pfnEnumFans_t)GetProcAddress(hinstLibPtr, "ctlEnumFans"); + if (pfnEnumFans) + { + result = pfnEnumFans(hDAhandle, pCount, phFan); + } + } + + return result; +} + + +/** +* @brief Get fan properties +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFan` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +*/ +ctl_result_t CTL_APICALL +ctlFanGetProperties( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + ctl_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFanGetProperties_t pfnFanGetProperties = (ctl_pfnFanGetProperties_t)GetProcAddress(hinstLibPtr, "ctlFanGetProperties"); + if (pfnFanGetProperties) + { + result = pfnFanGetProperties(hFan, pProperties); + } + } + + return result; +} + + +/** +* @brief Get fan configurations and the current fan speed mode (default, fixed, +* temp-speed table) +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFan` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pConfig` +*/ +ctl_result_t CTL_APICALL +ctlFanGetConfig( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + ctl_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFanGetConfig_t pfnFanGetConfig = (ctl_pfnFanGetConfig_t)GetProcAddress(hinstLibPtr, "ctlFanGetConfig"); + if (pfnFanGetConfig) + { + result = pfnFanGetConfig(hFan, pConfig); + } + } + + return result; +} + + +/** +* @brief Configure the fan to run with hardware factory settings (set mode to +* ::CTL_FAN_SPEED_MODE_DEFAULT) +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFan` +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +* + User does not have permissions to make these modifications. +*/ +ctl_result_t CTL_APICALL +ctlFanSetDefaultMode( + ctl_fan_handle_t hFan ///< [in] Handle for the component. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFanSetDefaultMode_t pfnFanSetDefaultMode = (ctl_pfnFanSetDefaultMode_t)GetProcAddress(hinstLibPtr, "ctlFanSetDefaultMode"); + if (pfnFanSetDefaultMode) + { + result = pfnFanSetDefaultMode(hFan); + } + } + + return result; +} + + +/** +* @brief Configure the fan to rotate at a fixed speed (set mode to +* ::CTL_FAN_SPEED_MODE_FIXED) +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFan` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == speed` +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +* + User does not have permissions to make these modifications. +* - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE +* + Fixing the fan speed not supported by the hardware or the fan speed units are not supported. See ::ctl_fan_properties_t.supportedModes and ::ctl_fan_properties_t.supportedUnits. +*/ +ctl_result_t CTL_APICALL +ctlFanSetFixedSpeedMode( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + const ctl_fan_speed_t* speed ///< [in] The fixed fan speed setting + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFanSetFixedSpeedMode_t pfnFanSetFixedSpeedMode = (ctl_pfnFanSetFixedSpeedMode_t)GetProcAddress(hinstLibPtr, "ctlFanSetFixedSpeedMode"); + if (pfnFanSetFixedSpeedMode) + { + result = pfnFanSetFixedSpeedMode(hFan, speed); + } + } + + return result; +} + + +/** +* @brief Configure the fan to adjust speed based on a temperature/speed table +* (set mode to ::CTL_FAN_SPEED_MODE_TABLE) +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFan` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == speedTable` +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +* + User does not have permissions to make these modifications. +* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT +* + The temperature/speed pairs in the array are not sorted on temperature from lowest to highest. +* - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE +* + Fan speed table not supported by the hardware or the fan speed units are not supported. See ::ctl_fan_properties_t.supportedModes and ::ctl_fan_properties_t.supportedUnits. +*/ +ctl_result_t CTL_APICALL +ctlFanSetSpeedTableMode( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + const ctl_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFanSetSpeedTableMode_t pfnFanSetSpeedTableMode = (ctl_pfnFanSetSpeedTableMode_t)GetProcAddress(hinstLibPtr, "ctlFanSetSpeedTableMode"); + if (pfnFanSetSpeedTableMode) + { + result = pfnFanSetSpeedTableMode(hFan, speedTable); + } + } + + return result; +} + + +/** +* @brief Get current state of a fan - current mode and speed +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFan` +* - CTL_RESULT_ERROR_INVALID_ENUMERATION +* + `::CTL_FAN_SPEED_UNITS_PERCENT < units` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pSpeed` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE +* + The requested fan speed units are not supported. See ::ctl_fan_properties_t.supportedUnits. +*/ +ctl_result_t CTL_APICALL +ctlFanGetState( + ctl_fan_handle_t hFan, ///< [in] Handle for the component. + ctl_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. + int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units + ///< requested. A value of -1 indicates that the fan speed cannot be + ///< measured. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFanGetState_t pfnFanGetState = (ctl_pfnFanGetState_t)GetProcAddress(hinstLibPtr, "ctlFanGetState"); + if (pfnFanGetState) + { + result = pfnFanGetState(hFan, units, pSpeed); + } + } + + return result; +} + + +/** +* @brief Get handle of frequency domains +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +*/ +ctl_result_t CTL_APICALL +ctlEnumFrequencyDomains( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumFrequencyDomains_t pfnEnumFrequencyDomains = (ctl_pfnEnumFrequencyDomains_t)GetProcAddress(hinstLibPtr, "ctlEnumFrequencyDomains"); + if (pfnEnumFrequencyDomains) + { + result = pfnEnumFrequencyDomains(hDAhandle, pCount, phFrequency); + } + } + + return result; +} + + +/** +* @brief Get frequency properties - available frequencies +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFrequency` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +*/ +ctl_result_t CTL_APICALL +ctlFrequencyGetProperties( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + ctl_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFrequencyGetProperties_t pfnFrequencyGetProperties = (ctl_pfnFrequencyGetProperties_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetProperties"); + if (pfnFrequencyGetProperties) + { + result = pfnFrequencyGetProperties(hFrequency, pProperties); + } + } + + return result; +} + + +/** +* @brief Get available non-overclocked hardware clock frequencies for the +* frequency domain +* +* @details +* - The list of available frequencies is returned in order of slowest to +* fastest. +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFrequency` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +*/ +ctl_result_t CTL_APICALL +ctlFrequencyGetAvailableClocks( + ctl_freq_handle_t hFrequency, ///< [in] Device handle of the device. + uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. + ///< if count is zero, then the driver shall update the value with the + ///< total number of frequencies that are available. + ///< if count is greater than the number of frequencies that are available, + ///< then the driver shall update the value with the correct number of frequencies. + double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of + ///< MHz and sorted from slowest to fastest. + ///< if count is less than the number of frequencies that are available, + ///< then the driver shall only retrieve that number of frequencies. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFrequencyGetAvailableClocks_t pfnFrequencyGetAvailableClocks = (ctl_pfnFrequencyGetAvailableClocks_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetAvailableClocks"); + if (pfnFrequencyGetAvailableClocks) + { + result = pfnFrequencyGetAvailableClocks(hFrequency, pCount, phFrequency); + } + } + + return result; +} + + +/** +* @brief Get current frequency limits +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFrequency` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pLimits` +*/ +ctl_result_t CTL_APICALL +ctlFrequencyGetRange( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + ctl_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the + ///< specified domain. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFrequencyGetRange_t pfnFrequencyGetRange = (ctl_pfnFrequencyGetRange_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetRange"); + if (pfnFrequencyGetRange) + { + result = pfnFrequencyGetRange(hFrequency, pLimits); + } + } + + return result; +} + + +/** +* @brief Set frequency range between which the hardware can operate. +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFrequency` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pLimits` +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +* + User does not have permissions to make these modifications. +*/ +ctl_result_t CTL_APICALL +ctlFrequencySetRange( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + const ctl_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the + ///< specified domain. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFrequencySetRange_t pfnFrequencySetRange = (ctl_pfnFrequencySetRange_t)GetProcAddress(hinstLibPtr, "ctlFrequencySetRange"); + if (pfnFrequencySetRange) + { + result = pfnFrequencySetRange(hFrequency, pLimits); + } + } + + return result; +} + + +/** +* @brief Get current frequency state - frequency request, actual frequency, TDP +* limits +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFrequency` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pState` +*/ +ctl_result_t CTL_APICALL +ctlFrequencyGetState( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + ctl_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFrequencyGetState_t pfnFrequencyGetState = (ctl_pfnFrequencyGetState_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetState"); + if (pfnFrequencyGetState) + { + result = pfnFrequencyGetState(hFrequency, pState); + } + } + + return result; +} + + +/** +* @brief Get frequency throttle time +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFrequency` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pThrottleTime` +*/ +ctl_result_t CTL_APICALL +ctlFrequencyGetThrottleTime( + ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. + ctl_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the + ///< specified domain. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnFrequencyGetThrottleTime_t pfnFrequencyGetThrottleTime = (ctl_pfnFrequencyGetThrottleTime_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetThrottleTime"); + if (pfnFrequencyGetThrottleTime) + { + result = pfnFrequencyGetThrottleTime(hFrequency, pThrottleTime); + } + } + + return result; +} + + +/** +* @brief Get Video Processing capabilities +* +* @details +* - The application gets Video Processing properties +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pFeatureCaps` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetSupportedVideoProcessingCapabilities( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_video_processing_feature_caps_t* pFeatureCaps ///< [in,out][release] Video Processing properties + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSupportedVideoProcessingCapabilities_t pfnGetSupportedVideoProcessingCapabilities = (ctl_pfnGetSupportedVideoProcessingCapabilities_t)GetProcAddress(hinstLibPtr, "ctlGetSupportedVideoProcessingCapabilities"); + if (pfnGetSupportedVideoProcessingCapabilities) + { + result = pfnGetSupportedVideoProcessingCapabilities(hDAhandle, pFeatureCaps); + } + } + + return result; +} + + +/** +* @brief Get/Set Video Processing feature details +* +* @details +* - Video Processing feature details +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pFeature` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetSetVideoProcessingFeature( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_video_processing_feature_getset_t* pFeature ///< [in][release] Video Processing feature get/set parameter + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetSetVideoProcessingFeature_t pfnGetSetVideoProcessingFeature = (ctl_pfnGetSetVideoProcessingFeature_t)GetProcAddress(hinstLibPtr, "ctlGetSetVideoProcessingFeature"); + if (pfnGetSetVideoProcessingFeature) + { + result = pfnGetSetVideoProcessingFeature(hDAhandle, pFeature); + } + } + + return result; +} + + +/** +* @brief Get handle of memory modules +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +*/ +ctl_result_t CTL_APICALL +ctlEnumMemoryModules( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumMemoryModules_t pfnEnumMemoryModules = (ctl_pfnEnumMemoryModules_t)GetProcAddress(hinstLibPtr, "ctlEnumMemoryModules"); + if (pfnEnumMemoryModules) + { + result = pfnEnumMemoryModules(hDAhandle, pCount, phMemory); + } + } + + return result; +} + + +/** +* @brief Get memory properties +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hMemory` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +*/ +ctl_result_t CTL_APICALL +ctlMemoryGetProperties( + ctl_mem_handle_t hMemory, ///< [in] Handle for the component. + ctl_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnMemoryGetProperties_t pfnMemoryGetProperties = (ctl_pfnMemoryGetProperties_t)GetProcAddress(hinstLibPtr, "ctlMemoryGetProperties"); + if (pfnMemoryGetProperties) + { + result = pfnMemoryGetProperties(hMemory, pProperties); + } + } + + return result; +} + + +/** +* @brief Get memory state - health, allocated +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hMemory` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pState` +*/ +ctl_result_t CTL_APICALL +ctlMemoryGetState( + ctl_mem_handle_t hMemory, ///< [in] Handle for the component. + ctl_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnMemoryGetState_t pfnMemoryGetState = (ctl_pfnMemoryGetState_t)GetProcAddress(hinstLibPtr, "ctlMemoryGetState"); + if (pfnMemoryGetState) + { + result = pfnMemoryGetState(hMemory, pState); + } + } + + return result; +} + + +/** +* @brief Get memory bandwidth +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hMemory` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pBandwidth` +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +* + User does not have permissions to query this telemetry. +*/ +ctl_result_t CTL_APICALL +ctlMemoryGetBandwidth( + ctl_mem_handle_t hMemory, ///< [in] Handle for the component. + ctl_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the current health, free memory, total memory + ///< size. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnMemoryGetBandwidth_t pfnMemoryGetBandwidth = (ctl_pfnMemoryGetBandwidth_t)GetProcAddress(hinstLibPtr, "ctlMemoryGetBandwidth"); + if (pfnMemoryGetBandwidth) + { + result = pfnMemoryGetBandwidth(hMemory, pBandwidth); + } + } + + return result; +} + + +/** +* @brief Get overclock properties - available properties. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pOcProperties` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGetProperties( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + ctl_oc_properties_t* pOcProperties ///< [in,out] The overclocking properties for the specified domain. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGetProperties_t pfnOverclockGetProperties = (ctl_pfnOverclockGetProperties_t)GetProcAddress(hinstLibPtr, "ctlOverclockGetProperties"); + if (pfnOverclockGetProperties) + { + result = pfnOverclockGetProperties(hDeviceHandle, pOcProperties); + } + } + + return result; +} + + +/** +* @brief Overclock Waiver - Warranty Waiver. +* +* @details +* - Most of the overclock functions will return an error if the waiver is +* not set. This is because most overclock settings will increase the +* electric/thermal stress on the part and thus reduce its lifetime. +* - By setting the waiver, the user is indicate that they are accepting a +* reduction in the lifetime of the part. +* - It is the responsibility of overclock applications to notify each user +* at least once with a popup of the dangers and requiring acceptance. +* - Only once the user has accepted should this function be called by the +* application. +* - It is acceptable for the application to cache the user choice and call +* this function on future executions without issuing the popup. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockWaiverSet( + ctl_device_adapter_handle_t hDeviceHandle ///< [in][release] Handle to display adapter + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockWaiverSet_t pfnOverclockWaiverSet = (ctl_pfnOverclockWaiverSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockWaiverSet"); + if (pfnOverclockWaiverSet) + { + result = pfnOverclockWaiverSet(hDeviceHandle); + } + } + + return result; +} + + +/** +* @brief Get the Overclock Frequency Offset for the GPU in MHz. +* +* @details +* - Determine the current frequency offset in effect (refer to +* ::ctlOverclockGpuFrequencyOffsetSet() for details). +* - The value returned may be different from the value that was previously +* set by the application depending on hardware limitations or if the +* function ::ctlOverclockGpuFrequencyOffsetSet() has been called or +* another application that has changed the value. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pOcFrequencyOffset` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuFrequencyOffsetGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcFrequencyOffset ///< [in,out] The Turbo Overclocking Frequency Desired in MHz. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuFrequencyOffsetGet_t pfnOverclockGpuFrequencyOffsetGet = (ctl_pfnOverclockGpuFrequencyOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuFrequencyOffsetGet"); + if (pfnOverclockGpuFrequencyOffsetGet) + { + result = pfnOverclockGpuFrequencyOffsetGet(hDeviceHandle, pOcFrequencyOffset); + } + } + + return result; +} + + +/** +* @brief Set the Overclock Frequency Offset for the GPU in MHZ. +* +* @details +* - The purpose of this function is to increase/decrease the frequency at +* which typical workloads will run within the same thermal budget. +* - The frequency offset is expressed in units of ±1MHz. +* - The actual operating frequency for each workload is not guaranteed to +* change exactly by the specified offset. +* - For positive frequency offsets, the factory maximum frequency may +* increase by up to the specified amount. +* - For negative frequency offsets, the overclock waiver must have been +* set since this can result in running the part at voltages beyond the +* part warrantee limits. An error is returned if the waiver has not been +* set. +* - Specifying large values for the frequency offset can lead to +* instability. It is recommended that changes are made in small +* increments and stability/performance measured running intense GPU +* workloads before increasing further. +* - This setting is not persistent through system reboots or driver +* resets/hangs. It is up to the overclock application to reapply the +* settings in those cases. +* - This setting can cause system/device instability. It is up to the +* overclock application to detect if the system has rebooted +* unexpectedly or the device was restarted. When this occurs, the +* application should not reapply the overclock settings automatically +* but instead return to previously known good settings or notify the +* user that the settings are not being applied. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuFrequencyOffsetSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocFrequencyOffset ///< [in] The Turbo Overclocking Frequency Desired in MHz. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuFrequencyOffsetSet_t pfnOverclockGpuFrequencyOffsetSet = (ctl_pfnOverclockGpuFrequencyOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuFrequencyOffsetSet"); + if (pfnOverclockGpuFrequencyOffsetSet) + { + result = pfnOverclockGpuFrequencyOffsetSet(hDeviceHandle, ocFrequencyOffset); + } + } + + return result; +} + + +/** +* @brief Get the Overclock Gpu Voltage Offset in mV. +* +* @details +* - Determine the current voltage offset in effect on the hardware (refer +* to ::ctlOverclockGpuVoltageOffsetSet for details). +* - The value returned may be different from the value that was previously +* set by the application depending on hardware limitations or if the +* function ::ctlOverclockGpuVoltageOffsetSet has been called or another +* application that has changed the value. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pOcVoltageOffset` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuVoltageOffsetGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcVoltageOffset ///< [in,out] The Turbo Overclocking Frequency Desired in mV. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuVoltageOffsetGet_t pfnOverclockGpuVoltageOffsetGet = (ctl_pfnOverclockGpuVoltageOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuVoltageOffsetGet"); + if (pfnOverclockGpuVoltageOffsetGet) + { + result = pfnOverclockGpuVoltageOffsetGet(hDeviceHandle, pOcVoltageOffset); + } + } + + return result; +} + + +/** +* @brief Set the Overclock Gpu Voltage Offset in mV. +* +* @details +* - The purpose of this function is to attempt to run the GPU up to higher +* voltages beyond the part warrantee limits. This can permit running at +* even higher frequencies than can be obtained using the frequency +* offset setting, but at the risk of reducing the lifetime of the part. +* - The voltage offset is expressed in units of ±millivolts with values +* permitted down to a resolution of 1 millivolt. +* - The overclock waiver must be set before calling this function +* otherwise and error will be returned. +* - There is no guarantee that a workload can operate at the higher +* frequencies permitted by this setting. Significantly more heat will be +* generated at these high frequencies/voltages which will necessitate a +* good cooling solution. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuVoltageOffsetSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocVoltageOffset ///< [in] The Turbo Overclocking Frequency Desired in mV. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuVoltageOffsetSet_t pfnOverclockGpuVoltageOffsetSet = (ctl_pfnOverclockGpuVoltageOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuVoltageOffsetSet"); + if (pfnOverclockGpuVoltageOffsetSet) + { + result = pfnOverclockGpuVoltageOffsetSet(hDeviceHandle, ocVoltageOffset); + } + } + + return result; +} + + +/** +* @brief Gets the Locked GPU Voltage for Overclocking in mV. +* +* @details +* - The purpose of this function is to determine if the current values of +* the frequency/voltage lock. +* - If the lock is not currently active, will return 0 for frequency and +* voltage. +* - Note that the operating frequency/voltage may be lower than these +* settings if power/thermal limits are exceeded. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pVfPair` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuLockGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + ctl_oc_vf_pair_t* pVfPair ///< [out] The current locked voltage and frequency. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuLockGet_t pfnOverclockGpuLockGet = (ctl_pfnOverclockGpuLockGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuLockGet"); + if (pfnOverclockGpuLockGet) + { + result = pfnOverclockGpuLockGet(hDeviceHandle, pVfPair); + } + } + + return result; +} + + +/** +* @brief Locks the GPU voltage for Overclocking in mV. +* +* @details +* - The purpose of this function is to provide an interface for scanners +* to lock the frequency and voltage to fixed values. +* - The frequency is expressed in units of MHz with a resolution of 1MHz. +* - The voltage is expressed in units of ±millivolts with values +* permitted down to a resolution of 1 millivolt. +* - The overclock waiver must be set since fixing the voltage at a high +* value puts unnecessary stress on the part. +* - The actual frequency may reduce depending on power/thermal +* limitations. +* - Requesting a frequency and/or voltage of 0 will return the hardware to +* dynamic frequency/voltage management with any previous frequency +* offset or voltage offset settings reapplied. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuLockSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + ctl_oc_vf_pair_t vFPair ///< [in] The current locked voltage and frequency. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuLockSet_t pfnOverclockGpuLockSet = (ctl_pfnOverclockGpuLockSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuLockSet"); + if (pfnOverclockGpuLockSet) + { + result = pfnOverclockGpuLockSet(hDeviceHandle, vFPair); + } + } + + return result; +} + + +/** +* @brief Get the current Vram Frequency Offset in GT/s. +* +* @details +* - The purpose of this function is to return the current VRAM frequency +* offset in units of GT/s. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pOcFrequencyOffset` +*/ +ctl_result_t CTL_APICALL +ctlOverclockVramFrequencyOffsetGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcFrequencyOffset ///< [in,out] The current Memory Frequency in GT/s. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockVramFrequencyOffsetGet_t pfnOverclockVramFrequencyOffsetGet = (ctl_pfnOverclockVramFrequencyOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramFrequencyOffsetGet"); + if (pfnOverclockVramFrequencyOffsetGet) + { + result = pfnOverclockVramFrequencyOffsetGet(hDeviceHandle, pOcFrequencyOffset); + } + } + + return result; +} + + +/** +* @brief Set the desired Vram frquency Offset in GT/s +* +* @details +* - The purpose of this function is to increase/decrease the frequency of +* VRAM. +* - The frequency offset is expressed in units of GT/s with a minimum step +* size given by ::ctlOverclockGetProperties. +* - The actual operating frequency for each workload is not guaranteed to +* change exactly by the specified offset. +* - The waiver must be set using clibOverclockWaiverSet() before this +* function can be called. +* - This setting is not persistent through system reboots or driver +* resets/hangs. It is up to the overclock application to reapply the +* settings in those cases. +* - This setting can cause system/device instability. It is up to the +* overclock application to detect if the system has rebooted +* unexpectedly or the device was restarted. When this occurs, the +* application should not reapply the overclock settings automatically +* but instead return to previously known good settings or notify the +* user that the settings are not being applied. +* - If the memory controller doesn't support changes to frequency on the +* fly, one of the following return codes will be given: +* - ::CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory +* overclock will be applied when the device is reset or the system is +* rebooted. In this case, the overclock software should check if the +* overclock request was applied after the reset/reboot. If it was and +* when the overclock application shuts down gracefully and if the +* overclock application wants the setting to be persistent, the +* application should request the same overclock settings again so that +* they will be applied on the next reset/reboot. If this is not done, +* then every time the device is reset and overclock is requested, the +* device needs to be reset a second time. +* - ::CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory +* overclock will be applied when the system is rebooted. In this case, +* the overclock software should check if the overclock request was +* applied after the reboot. If it was and when the overclock application +* shuts down gracefully and if the overclock application wants the +* setting to be persistent, the application should request the same +* overclock settings again so that they will be applied on the next +* reset/reboot. If this is not done and the overclock setting is +* requested after the reboot has occurred, a second reboot will be +* required. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockVramFrequencyOffsetSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocFrequencyOffset ///< [in] The desired Memory Frequency in GT/s. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockVramFrequencyOffsetSet_t pfnOverclockVramFrequencyOffsetSet = (ctl_pfnOverclockVramFrequencyOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramFrequencyOffsetSet"); + if (pfnOverclockVramFrequencyOffsetSet) + { + result = pfnOverclockVramFrequencyOffsetSet(hDeviceHandle, ocFrequencyOffset); + } + } + + return result; +} + + +/** +* @brief Get the Overclock Vram Voltage Offset in mV. +* +* @details +* - The purpose of this function is to increase/decrease the voltage of +* VRAM. +* - The voltage offset is expressed in units of millivolts with a minimum +* step size given by ::ctlOverclockGetProperties. +* - The waiver must be set using ::ctlOverclockWaiverSet before this +* function can be called. +* - This setting is not persistent through system reboots or driver +* resets/hangs. It is up to the overclock application to reapply the +* settings in those cases. +* - This setting can cause system/device instability. It is up to the +* overclock application to detect if the system has rebooted +* unexpectedly or the device was restarted. When this occurs, the +* application should not reapply the overclock settings automatically +* but instead return to previously known good settings or notify the +* user that the settings are not being applied. +* - If the memory controller doesn't support changes to voltage on the +* fly, one of the following return codes will be given: +* - ::CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory +* overclock will be applied when the device is reset or the system is +* rebooted. In this case, the overclock software should check if the +* overclock request was applied after the reset/reboot. If it was and +* when the overclock application shuts down gracefully and if the +* overclock application wants the setting to be persistent, the +* application should request the same overclock settings again so that +* they will be applied on the next reset/reboot. If this is not done, +* then every time the device is reset and overclock is requested, the +* device needs to be reset a second time. +* - ::CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory +* overclock will be applied when the system is rebooted. In this case, +* the overclock software should check if the overclock request was +* applied after the reboot. If it was and when the overclock application +* shuts down gracefully and if the overclock application wants the +* setting to be persistent, the application should request the same +* overclock settings again so that they will be applied on the next +* reset/reboot. If this is not done and the overclock setting is +* requested after the reboot has occurred, a second reboot will be +* required. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pVoltage` +*/ +ctl_result_t CTL_APICALL +ctlOverclockVramVoltageOffsetGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pVoltage ///< [out] The current locked voltage in mV. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockVramVoltageOffsetGet_t pfnOverclockVramVoltageOffsetGet = (ctl_pfnOverclockVramVoltageOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramVoltageOffsetGet"); + if (pfnOverclockVramVoltageOffsetGet) + { + result = pfnOverclockVramVoltageOffsetGet(hDeviceHandle, pVoltage); + } + } + + return result; +} + + +/** +* @brief Set the Overclock Vram Voltage Offset in mV. +* +* @details +* - The purpose of this function is to set the maximum sustained power +* limit. If the average GPU power averaged over a few seconds exceeds +* this value, the frequency of the GPU will be throttled. +* - Set a value of 0 to disable this power limit. In this case, the GPU +* frequency will not throttle due to average power but may hit other +* limits. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockVramVoltageOffsetSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double voltage ///< [in] The voltage to be locked in mV. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockVramVoltageOffsetSet_t pfnOverclockVramVoltageOffsetSet = (ctl_pfnOverclockVramVoltageOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramVoltageOffsetSet"); + if (pfnOverclockVramVoltageOffsetSet) + { + result = pfnOverclockVramVoltageOffsetSet(hDeviceHandle, voltage); + } + } + + return result; +} + + +/** +* @brief Get the sustained power limit in mW. +* +* @details +* - The purpose of this function is to read the current sustained power +* limit. +* - A value of 0 means that the limit is disabled - the GPU frequency can +* run as high as possible until other limits are hit. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pSustainedPowerLimit` +*/ +ctl_result_t CTL_APICALL +ctlOverclockPowerLimitGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pSustainedPowerLimit ///< [in,out] The current sustained power limit in mW. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockPowerLimitGet_t pfnOverclockPowerLimitGet = (ctl_pfnOverclockPowerLimitGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockPowerLimitGet"); + if (pfnOverclockPowerLimitGet) + { + result = pfnOverclockPowerLimitGet(hDeviceHandle, pSustainedPowerLimit); + } + } + + return result; +} + + +/** +* @brief Set the sustained power limit in mW. +* +* @details +* - The purpose of this function is to set the maximum sustained power +* limit. If the average GPU power averaged over a few seconds exceeds +* this value, the frequency of the GPU will be throttled. +* - Set a value of 0 to disable this power limit. In this case, the GPU +* frequency will not throttle due to average power but may hit other +* limits. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockPowerLimitSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double sustainedPowerLimit ///< [in] The desired sustained power limit in mW. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockPowerLimitSet_t pfnOverclockPowerLimitSet = (ctl_pfnOverclockPowerLimitSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockPowerLimitSet"); + if (pfnOverclockPowerLimitSet) + { + result = pfnOverclockPowerLimitSet(hDeviceHandle, sustainedPowerLimit); + } + } + + return result; +} + + +/** +* @brief Get the current temperature limit in Celsius. +* +* @details +* - The purpose of this function is to read the current thermal limit. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pTemperatureLimit` +*/ +ctl_result_t CTL_APICALL +ctlOverclockTemperatureLimitGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pTemperatureLimit ///< [in,out] The current temperature limit in Celsius. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockTemperatureLimitGet_t pfnOverclockTemperatureLimitGet = (ctl_pfnOverclockTemperatureLimitGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockTemperatureLimitGet"); + if (pfnOverclockTemperatureLimitGet) + { + result = pfnOverclockTemperatureLimitGet(hDeviceHandle, pTemperatureLimit); + } + } + + return result; +} + + +/** +* @brief Set the temperature limit in Celsius. +* +* @details +* - The purpose of this function is to change the maximum thermal limit. +* When the GPU temperature exceeds this value, the GPU frequency will be +* throttled. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockTemperatureLimitSet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double temperatureLimit ///< [in] The desired temperature limit in Celsius. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockTemperatureLimitSet_t pfnOverclockTemperatureLimitSet = (ctl_pfnOverclockTemperatureLimitSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockTemperatureLimitSet"); + if (pfnOverclockTemperatureLimitSet) + { + result = pfnOverclockTemperatureLimitSet(hDeviceHandle, temperatureLimit); + } + } + + return result; +} + + +/** +* @brief Get Power Telemetry. +* +* @details +* - Limited rate of 50 ms, any call under 50 ms will return the same +* information. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pTelemetryInfo` +*/ +ctl_result_t CTL_APICALL +ctlPowerTelemetryGet( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + ctl_power_telemetry_t* pTelemetryInfo ///< [out] The overclocking properties for the specified domain. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPowerTelemetryGet_t pfnPowerTelemetryGet = (ctl_pfnPowerTelemetryGet_t)GetProcAddress(hinstLibPtr, "ctlPowerTelemetryGet"); + if (pfnPowerTelemetryGet) + { + result = pfnPowerTelemetryGet(hDeviceHandle, pTelemetryInfo); + } + } + + return result; +} + + +/** +* @brief Reset all Overclock Settings to stock +* +* @details +* - Reset all Overclock setting to default using single API call +* - This request resets any changes made to GpuFrequencyOffset, +* GpuVoltageOffset, PowerLimit, TemperatureLimit, GpuLock +* - This Doesn't reset any Fan Curve Changes. It can be reset using +* ctlFanSetDefaultMode +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockResetToDefault( + ctl_device_adapter_handle_t hDeviceHandle ///< [in][release] Handle to display adapter + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockResetToDefault_t pfnOverclockResetToDefault = (ctl_pfnOverclockResetToDefault_t)GetProcAddress(hinstLibPtr, "ctlOverclockResetToDefault"); + if (pfnOverclockResetToDefault) + { + result = pfnOverclockResetToDefault(hDeviceHandle); + } + } + + return result; +} + + +/** +* @brief Get PCI properties - address, max speed +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +*/ +ctl_result_t CTL_APICALL +ctlPciGetProperties( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPciGetProperties_t pfnPciGetProperties = (ctl_pfnPciGetProperties_t)GetProcAddress(hinstLibPtr, "ctlPciGetProperties"); + if (pfnPciGetProperties) + { + result = pfnPciGetProperties(hDAhandle, pProperties); + } + } + + return result; +} + + +/** +* @brief Get current PCI state - current speed +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pState` +*/ +ctl_result_t CTL_APICALL +ctlPciGetState( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_pci_state_t* pState ///< [in,out] Will contain the PCI properties. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPciGetState_t pfnPciGetState = (ctl_pfnPciGetState_t)GetProcAddress(hinstLibPtr, "ctlPciGetState"); + if (pfnPciGetState) + { + result = pfnPciGetState(hDAhandle, pState); + } + } + + return result; +} + + +/** +* @brief Get handle of power domains +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +*/ +ctl_result_t CTL_APICALL +ctlEnumPowerDomains( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumPowerDomains_t pfnEnumPowerDomains = (ctl_pfnEnumPowerDomains_t)GetProcAddress(hinstLibPtr, "ctlEnumPowerDomains"); + if (pfnEnumPowerDomains) + { + result = pfnEnumPowerDomains(hDAhandle, pCount, phPower); + } + } + + return result; +} + + +/** +* @brief Get properties related to a power domain +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hPower` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +*/ +ctl_result_t CTL_APICALL +ctlPowerGetProperties( + ctl_pwr_handle_t hPower, ///< [in] Handle for the component. + ctl_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPowerGetProperties_t pfnPowerGetProperties = (ctl_pfnPowerGetProperties_t)GetProcAddress(hinstLibPtr, "ctlPowerGetProperties"); + if (pfnPowerGetProperties) + { + result = pfnPowerGetProperties(hPower, pProperties); + } + } + + return result; +} + + +/** +* @brief Get energy counter +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hPower` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pEnergy` +*/ +ctl_result_t CTL_APICALL +ctlPowerGetEnergyCounter( + ctl_pwr_handle_t hPower, ///< [in] Handle for the component. + ctl_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and + ///< timestamp when the last counter value was measured. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPowerGetEnergyCounter_t pfnPowerGetEnergyCounter = (ctl_pfnPowerGetEnergyCounter_t)GetProcAddress(hinstLibPtr, "ctlPowerGetEnergyCounter"); + if (pfnPowerGetEnergyCounter) + { + result = pfnPowerGetEnergyCounter(hPower, pEnergy); + } + } + + return result; +} + + +/** +* @brief Get power limits +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hPower` +*/ +ctl_result_t CTL_APICALL +ctlPowerGetLimits( + ctl_pwr_handle_t hPower, ///< [in] Handle for the component. + ctl_power_limits_t* pPowerLimits ///< [in,out][optional] Structure that will contain the power limits. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPowerGetLimits_t pfnPowerGetLimits = (ctl_pfnPowerGetLimits_t)GetProcAddress(hinstLibPtr, "ctlPowerGetLimits"); + if (pfnPowerGetLimits) + { + result = pfnPowerGetLimits(hPower, pPowerLimits); + } + } + + return result; +} + + +/** +* @brief Set power limits +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hPower` +* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS +* + User does not have permissions to make these modifications. +* - ::CTL_RESULT_ERROR_NOT_AVAILABLE +* + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. +*/ +ctl_result_t CTL_APICALL +ctlPowerSetLimits( + ctl_pwr_handle_t hPower, ///< [in] Handle for the component. + const ctl_power_limits_t* pPowerLimits ///< [in][optional] Structure that will contain the power limits. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnPowerSetLimits_t pfnPowerSetLimits = (ctl_pfnPowerSetLimits_t)GetProcAddress(hinstLibPtr, "ctlPowerSetLimits"); + if (pfnPowerSetLimits) + { + result = pfnPowerSetLimits(hPower, pPowerLimits); + } + } + + return result; +} + + +/** +* @brief Get handle of temperature sensors +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +*/ +ctl_result_t CTL_APICALL +ctlEnumTemperatureSensors( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< if count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumTemperatureSensors_t pfnEnumTemperatureSensors = (ctl_pfnEnumTemperatureSensors_t)GetProcAddress(hinstLibPtr, "ctlEnumTemperatureSensors"); + if (pfnEnumTemperatureSensors) + { + result = pfnEnumTemperatureSensors(hDAhandle, pCount, phTemperature); + } + } + + return result; +} + + +/** +* @brief Get temperature sensor properties +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hTemperature` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +*/ +ctl_result_t CTL_APICALL +ctlTemperatureGetProperties( + ctl_temp_handle_t hTemperature, ///< [in] Handle for the component. + ctl_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnTemperatureGetProperties_t pfnTemperatureGetProperties = (ctl_pfnTemperatureGetProperties_t)GetProcAddress(hinstLibPtr, "ctlTemperatureGetProperties"); + if (pfnTemperatureGetProperties) + { + result = pfnTemperatureGetProperties(hTemperature, pProperties); + } + } + + return result; +} + + +/** +* @brief Get the temperature from a specified sensor +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hTemperature` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pTemperature` +*/ +ctl_result_t CTL_APICALL +ctlTemperatureGetState( + ctl_temp_handle_t hTemperature, ///< [in] Handle for the component. + double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor + ///< in degrees Celsius. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnTemperatureGetState_t pfnTemperatureGetState = (ctl_pfnTemperatureGetState_t)GetProcAddress(hinstLibPtr, "ctlTemperatureGetState"); + if (pfnTemperatureGetState) + { + result = pfnTemperatureGetState(hTemperature, pTemperature); + } + } + + return result; +} + + +// +// End of wrapper function implementation +// +///////////////////////////////////////////////////////////////////////////////// diff --git a/include/igcl_api.h b/include/igcl_api.h index e931d1a..0b2d02f 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -394,11 +394,12 @@ typedef enum _ctl_result_t CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE = 0x44000002, ///< The Voltage exceeds the acceptable min/max. CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE = 0x44000003, ///< The Frequency exceeds the acceptable min/max. CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE = 0x44000004, ///< The Power exceeds the acceptable min/max. - CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE = 0x44000005, ///< The Power exceeds the acceptable min/max. + CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE = 0x44000005, ///< The Temperature exceeds the acceptable min/max. CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE = 0x44000006,///< The Overclock is in voltage locked mode. CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED = 0x44000007,///< It indicates that the requested change will not be applied until the ///< device is reset. CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET = 0x44000008,///< The $OverclockWaiverSet function has not been called. + CTL_RESULT_ERROR_CORE_OVERCLOCK_DEPRECATED_API = 0x44000009,///< The error indicates to switch to newer API version if applicable. CTL_RESULT_ERROR_CORE_END = 0x0440FFFF, ///< "Core error code end value, not to be used ///< " CTL_RESULT_ERROR_3D_START = 0x60000000, ///< 3D error code starting value, not to be used @@ -3421,14 +3422,21 @@ typedef struct _ctl_scaling_settings_t uint32_t Size; ///< [in] size of this structure uint8_t Version; ///< [in] version of this structure bool Enable; ///< [in,out] State of the scaler - ctl_scaling_type_flags_t ScalingType; ///< [in,out] Requested scaling types. Refer ::ctl_scaling_type_flag_t - uint32_t CustomScalingX; ///< [in,out] Custom Scaling X resolution - uint32_t CustomScalingY; ///< [in,out] Custom Scaling Y resolution + ctl_scaling_type_flags_t ScalingType; ///< [in,out] Requested scaling type. In Get call this field indicates + ///< 'currunt' scaling set. Refer ::ctl_scaling_type_flag_t + uint32_t CustomScalingX; ///< [in,out] Custom Scaling X in percentage. This is percentage of current + ///< OS resolution. Valid values are 0 to 100. Up to 11% of native + ///< resolution can be downscaled + uint32_t CustomScalingY; ///< [in,out] Custom Scaling Y in percentage. This is percentage of current + ///< OS resolution. Valid values are 0 to 100. Up to 11% of native + ///< resolution can be downscaled bool HardwareModeSet; ///< [in] Flag to indicate hardware modeset should be done to apply the ///< scaling.Setting this to true would result in a flash on the screen. If ///< this flag is set to false , API will request the OS to do a virtual ///< modeset , but the OS can ignore this request and do a hardware modeset ///< in some instances + ctl_scaling_type_flags_t PreferredScalingType; ///< [out] Indicates OS persisted scaling type. This field is only valid + ///< when version > 0. Refer ::ctl_scaling_type_flag_t } ctl_scaling_settings_t; From 9512dcc73da814dd6e900906f9524508f928ca72 Mon Sep 17 00:00:00 2001 From: Rohit Kumar Date: Thu, 25 Apr 2024 19:16:46 +0530 Subject: [PATCH 06/26] Remove stale files --- Source/igcl_api.h | 7906 --------------------------------------- include/cApiWrapper.cpp | 4776 ----------------------- 2 files changed, 12682 deletions(-) delete mode 100644 Source/igcl_api.h delete mode 100644 include/cApiWrapper.cpp diff --git a/Source/igcl_api.h b/Source/igcl_api.h deleted file mode 100644 index e931d1a..0000000 --- a/Source/igcl_api.h +++ /dev/null @@ -1,7906 +0,0 @@ -//=========================================================================== -// Copyright (C) 2022-23 Intel Corporation -// This software and the related documents are Intel copyrighted materials, and -// your use of them is governed by the express license under which they were -// provided to you ("License"). Unless the License provides otherwise, you may -// not use, modify, copy, publish, distribute, disclose or transmit this software -// or the related documents without Intel's prior written permission. This software -// and the related documents are provided as is, with no express or implied -// warranties, other than those that are expressly stated in the License. -//-------------------------------------------------------------------------- - -/** - * - * @file ctl_api.h - * @version v1-r1 - * - */ -#ifndef _CTL_API_H -#define _CTL_API_H -#if defined(__cplusplus) -#pragma once -#endif - -// standard headers -#include -#include - -#if defined(__cplusplus) -extern "C" { -#endif - -// Intel 'ctlApi' common types -#if !defined(__GNUC__) -#pragma region common -#endif -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_MAKE_VERSION -/// @brief Generates generic ::'ctlApi' API versions -#define CTL_MAKE_VERSION( _major, _minor ) (( _major << 16 )|( _minor & 0x0000ffff)) -#endif // CTL_MAKE_VERSION - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_MAJOR_VERSION -/// @brief Extracts ::'ctlApi' API major version -#define CTL_MAJOR_VERSION( _ver ) ( _ver >> 16 ) -#endif // CTL_MAJOR_VERSION - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_MINOR_VERSION -/// @brief Extracts ::'ctlApi' API minor version -#define CTL_MINOR_VERSION( _ver ) ( _ver & 0x0000ffff ) -#endif // CTL_MINOR_VERSION - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_IMPL_MAJOR_VERSION -/// @brief ::'ctlApi' API major version of this implementation -#define CTL_IMPL_MAJOR_VERSION 1 -#endif // CTL_IMPL_MAJOR_VERSION - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_IMPL_MINOR_VERSION -/// @brief ::'ctlApi' API minor version of this implementation -#define CTL_IMPL_MINOR_VERSION 1 -#endif // CTL_IMPL_MINOR_VERSION - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_IMPL_VERSION -/// @brief ::'ctlApi' API version of this implementation -#define CTL_IMPL_VERSION CTL_MAKE_VERSION( CTL_IMPL_MAJOR_VERSION, CTL_IMPL_MINOR_VERSION ) -#endif // CTL_IMPL_VERSION - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_APICALL -#if defined(_WIN32) -/// @brief Calling convention for all API functions -#define CTL_APICALL __cdecl -#else -#define CTL_APICALL -#endif // defined(_WIN32) -#endif // CTL_APICALL - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_APIEXPORT -#if defined(_WIN32) -/// @brief Microsoft-specific dllexport storage-class attribute -#define CTL_APIEXPORT __declspec(dllexport) -#else -#define CTL_APIEXPORT -#endif // defined(_WIN32) -#endif // CTL_APIEXPORT - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_DLLEXPORT -#if defined(_WIN32) -/// @brief Microsoft-specific dllexport storage-class attribute -#define CTL_DLLEXPORT __declspec(dllexport) -#endif // defined(_WIN32) -#endif // CTL_DLLEXPORT - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_DLLEXPORT -#if __GNUC__ >= 4 -/// @brief GCC-specific dllexport storage-class attribute -#define CTL_DLLEXPORT __attribute__ ((visibility ("default"))) -#else -#define CTL_DLLEXPORT -#endif // __GNUC__ >= 4 -#endif // CTL_DLLEXPORT - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_BIT -/// @brief Generic macro for enumerator bit masks -#define CTL_BIT( _i ) ( 1 << _i ) -#endif // CTL_BIT - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Supported initialization flags -typedef uint32_t ctl_init_flags_t; -typedef enum _ctl_init_flag_t -{ - CTL_INIT_FLAG_USE_LEVEL_ZERO = CTL_BIT(0), ///< Use Level0 or not. This is usually required for telemetry, - ///< performance, frequency related APIs - CTL_INIT_FLAG_MAX = 0x80000000 - -} ctl_init_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Version information -typedef uint32_t ctl_version_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a control API instance -typedef struct _ctl_api_handle_t *ctl_api_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a device adapter instance -typedef struct _ctl_device_adapter_handle_t *ctl_device_adapter_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a device temperature sensor -typedef struct _ctl_temp_handle_t *ctl_temp_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle for a device frequency domain -typedef struct _ctl_freq_handle_t *ctl_freq_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a power device. -typedef struct _ctl_pwr_handle_t *ctl_pwr_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a device fan -typedef struct _ctl_fan_handle_t *ctl_fan_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a device memory module -typedef struct _ctl_mem_handle_t *ctl_mem_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a device engine group -typedef struct _ctl_engine_handle_t *ctl_engine_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Base for all properties types -typedef struct _ctl_base_interface_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - -} ctl_base_interface_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Value type -typedef enum _ctl_property_value_type_t -{ - CTL_PROPERTY_VALUE_TYPE_BOOL = 0, ///< Boolean - CTL_PROPERTY_VALUE_TYPE_FLOAT = 1, ///< Float - CTL_PROPERTY_VALUE_TYPE_INT32 = 2, ///< Int32 - CTL_PROPERTY_VALUE_TYPE_UINT32 = 3, ///< Unsigned Int32 - CTL_PROPERTY_VALUE_TYPE_ENUM = 4, ///< Enum - CTL_PROPERTY_VALUE_TYPE_CUSTOM = 5, ///< Custom argument - CTL_PROPERTY_VALUE_TYPE_MAX - -} ctl_property_value_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Property range details, a generic struct to hold min/max/step size -/// information of various feature properties -typedef struct _ctl_property_range_info_t -{ - float min_possible_value; ///< [out] Minimum possible value - float max_possible_value; ///< [out] Maximum possible value - float step_size; ///< [out] Step size possible - float default_value; ///< [out] Default value - -} ctl_property_range_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Property range details of integer type, a generic struct to hold -/// min/max/step size information of various feature properties -typedef struct _ctl_property_range_info_int_t -{ - int32_t min_possible_value; ///< [out] Minimum possible value - int32_t max_possible_value; ///< [out] Maximum possible value - int32_t step_size; ///< [out] Step size possible - int32_t default_value; ///< [out] Default value - -} ctl_property_range_info_int_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Property range details of unsigned integer type, a generic struct to -/// hold min/max/step size information of various feature properties -typedef struct _ctl_property_range_info_uint_t -{ - uint32_t min_possible_value; ///< [out] Minimum possible value - uint32_t max_possible_value; ///< [out] Maximum possible value - uint32_t step_size; ///< [out] Step size possible - uint32_t default_value; ///< [out] Default value - -} ctl_property_range_info_uint_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Bool feature details -typedef struct _ctl_property_info_boolean_t -{ - bool DefaultState; ///< [out] Default state - -} ctl_property_info_boolean_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Bool feature for get/set -typedef struct _ctl_property_boolean_t -{ - bool Enable; ///< [in,out] Enable - -} ctl_property_boolean_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Enumeration feature details -typedef struct _ctl_property_info_enum_t -{ - uint64_t SupportedTypes; ///< [out] Supported possible values represented as a bitmask - uint32_t DefaultType; ///< [out] Default type - -} ctl_property_info_enum_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Enumeration feature for get/set -typedef struct _ctl_property_enum_t -{ - uint32_t EnableType; ///< [in,out] Enable with specific type - -} ctl_property_enum_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Float feature details -typedef struct _ctl_property_info_float_t -{ - bool DefaultEnable; ///< [in,out] DefaultEnable - ctl_property_range_info_t RangeInfo; ///< [out] Min/max/default/step details - -} ctl_property_info_float_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Float feature for get/set -typedef struct _ctl_property_float_t -{ - bool Enable; ///< [in,out] Enable - float Value; ///< [in,out] Value - -} ctl_property_float_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Int32 feature details -typedef struct _ctl_property_info_int_t -{ - bool DefaultEnable; ///< [in,out] DefaultEnable - ctl_property_range_info_int_t RangeInfo; ///< [out] Min/max/default/step details - -} ctl_property_info_int_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Int32 feature for get/set -typedef struct _ctl_property_int_t -{ - bool Enable; ///< [in,out] Enable - int32_t Value; ///< [in,out] Value - -} ctl_property_int_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Int32 feature details -typedef struct _ctl_property_info_uint_t -{ - bool DefaultEnable; ///< [in,out] DefaultEnable - ctl_property_range_info_uint_t RangeInfo; ///< [out] Min/max/default/step details - -} ctl_property_info_uint_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Int32 feature for get/set -typedef struct _ctl_property_uint_t -{ - bool Enable; ///< [in,out] Enable - uint32_t Value; ///< [in,out] Value - -} ctl_property_uint_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Feature element details, union of bool/float/enum property_info -/// structs. Used for feature specific capability check -typedef union _ctl_property_info_t -{ - ctl_property_info_boolean_t BoolType; ///< [in,out] Boolean type fields - ctl_property_info_float_t FloatType; ///< [in,out] Float type fields - ctl_property_info_int_t IntType; ///< [in,out] Int type fields - ctl_property_info_enum_t EnumType; ///< [in,out] Enum type fields - ctl_property_info_uint_t UIntType; ///< [in,out] Unsigned Int type fields - -} ctl_property_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Feature element details, union of bool/float/enum property structs. -/// Used for get/set calls -typedef union _ctl_property_t -{ - ctl_property_boolean_t BoolType; ///< [in,out] Boolean type fields - ctl_property_float_t FloatType; ///< [in,out] Float type fields - ctl_property_int_t IntType; ///< [in,out] Int type fields - ctl_property_enum_t EnumType; ///< [in,out] Enum type fields - ctl_property_uint_t UIntType; ///< [in,out] Unsigned Int type fields - -} ctl_property_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Defines Return/Error codes. -/// All generic error (bit30) codes are between 0x40000000-0x4000FFFF. -/// All 3D (bit 29) specific error codes are between 0x60000000-0x6000FFFF. -/// All media (bit 28) specific error codes are between 0x50000000-0x5000FFFF. -/// All display (bit 27) specific error codes are between 0x48000000-0x4800FFFF -/// All core (bit 26) specific error codes are between 0x44000000-0x4400FFFF -/// Success result code with additional info are between 0x00000001-0x0000FFFF. -typedef enum _ctl_result_t -{ - CTL_RESULT_SUCCESS = 0x00000000, ///< success - CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER = 0x00000001, ///< success but still open by another caller - CTL_RESULT_ERROR_SUCCESS_END = 0x0000FFFF, ///< "Success group error code end value, not to be used - ///< " - CTL_RESULT_ERROR_GENERIC_START = 0x40000000, ///< Generic error code starting value, not to be used - CTL_RESULT_ERROR_NOT_INITIALIZED = 0x40000001, ///< Result not initialized - CTL_RESULT_ERROR_ALREADY_INITIALIZED = 0x40000002, ///< Already initialized - CTL_RESULT_ERROR_DEVICE_LOST = 0x40000003, ///< Device hung, reset, was removed, or driver update occurred - CTL_RESULT_ERROR_OUT_OF_HOST_MEMORY = 0x40000004, ///< Insufficient host memory to satisfy call - CTL_RESULT_ERROR_OUT_OF_DEVICE_MEMORY = 0x40000005, ///< Insufficient device memory to satisfy call - CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS = 0x40000006, ///< Access denied due to permission level - CTL_RESULT_ERROR_NOT_AVAILABLE = 0x40000007, ///< Resource was removed - CTL_RESULT_ERROR_UNINITIALIZED = 0x40000008, ///< Library not initialized - CTL_RESULT_ERROR_UNSUPPORTED_VERSION = 0x40000009, ///< Generic error code for unsupported versions - CTL_RESULT_ERROR_UNSUPPORTED_FEATURE = 0x4000000a, ///< Generic error code for unsupported features - CTL_RESULT_ERROR_INVALID_ARGUMENT = 0x4000000b, ///< Generic error code for invalid arguments - CTL_RESULT_ERROR_INVALID_API_HANDLE = 0x4000000c, ///< API handle in invalid - CTL_RESULT_ERROR_INVALID_NULL_HANDLE = 0x4000000d, ///< Handle argument is not valid - CTL_RESULT_ERROR_INVALID_NULL_POINTER = 0x4000000e, ///< Pointer argument may not be nullptr - CTL_RESULT_ERROR_INVALID_SIZE = 0x4000000f, ///< Size argument is invalid (e.g., must not be zero) - CTL_RESULT_ERROR_UNSUPPORTED_SIZE = 0x40000010, ///< Size argument is not supported by the device (e.g., too large) - CTL_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 0x40000011, ///< Image format is not supported by the device - CTL_RESULT_ERROR_DATA_READ = 0x40000012, ///< Data read error - CTL_RESULT_ERROR_DATA_WRITE = 0x40000013, ///< Data write error - CTL_RESULT_ERROR_DATA_NOT_FOUND = 0x40000014, ///< Data not found error - CTL_RESULT_ERROR_NOT_IMPLEMENTED = 0x40000015, ///< Function not implemented - CTL_RESULT_ERROR_OS_CALL = 0x40000016, ///< Operating system call failure - CTL_RESULT_ERROR_KMD_CALL = 0x40000017, ///< Kernel mode driver call failure - CTL_RESULT_ERROR_UNLOAD = 0x40000018, ///< Library unload failure - CTL_RESULT_ERROR_ZE_LOADER = 0x40000019, ///< Level0 loader not found - CTL_RESULT_ERROR_INVALID_OPERATION_TYPE = 0x4000001a, ///< Invalid operation type - CTL_RESULT_ERROR_NULL_OS_INTERFACE = 0x4000001b,///< Null OS interface - CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE = 0x4000001c, ///< Null OS adapter handle - CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE = 0x4000001d,///< Null display output handle - CTL_RESULT_ERROR_WAIT_TIMEOUT = 0x4000001e, ///< Timeout in Wait function - CTL_RESULT_ERROR_PERSISTANCE_NOT_SUPPORTED = 0x4000001f,///< Persistance not supported - CTL_RESULT_ERROR_PLATFORM_NOT_SUPPORTED = 0x40000020, ///< Platform not supported - CTL_RESULT_ERROR_UNKNOWN_APPLICATION_UID = 0x40000021, ///< Unknown Appplicaion UID in Initialization call - CTL_RESULT_ERROR_INVALID_ENUMERATION = 0x40000022, ///< The enum is not valid - CTL_RESULT_ERROR_FILE_DELETE = 0x40000023, ///< Error in file delete operation - CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED = 0x40000024,///< The device requires a reset. - CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED = 0x40000025, ///< The device requires a full reboot. - CTL_RESULT_ERROR_LOAD = 0x40000026, ///< Library load failure - CTL_RESULT_ERROR_UNKNOWN = 0x4000FFFF, ///< Unknown or internal error - CTL_RESULT_ERROR_RETRY_OPERATION = 0x40010000, ///< Operation failed, retry previous operation again - CTL_RESULT_ERROR_GENERIC_END = 0x4000FFFF, ///< "Generic error code end value, not to be used - ///< " - CTL_RESULT_ERROR_CORE_START = 0x44000000, ///< Core error code starting value, not to be used - CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED = 0x44000001, ///< The Overclock is not supported. - CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE = 0x44000002, ///< The Voltage exceeds the acceptable min/max. - CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE = 0x44000003, ///< The Frequency exceeds the acceptable min/max. - CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE = 0x44000004, ///< The Power exceeds the acceptable min/max. - CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE = 0x44000005, ///< The Power exceeds the acceptable min/max. - CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE = 0x44000006,///< The Overclock is in voltage locked mode. - CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED = 0x44000007,///< It indicates that the requested change will not be applied until the - ///< device is reset. - CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET = 0x44000008,///< The $OverclockWaiverSet function has not been called. - CTL_RESULT_ERROR_CORE_END = 0x0440FFFF, ///< "Core error code end value, not to be used - ///< " - CTL_RESULT_ERROR_3D_START = 0x60000000, ///< 3D error code starting value, not to be used - CTL_RESULT_ERROR_3D_END = 0x6000FFFF, ///< "3D error code end value, not to be used - ///< " - CTL_RESULT_ERROR_MEDIA_START = 0x50000000, ///< Media error code starting value, not to be used - CTL_RESULT_ERROR_MEDIA_END = 0x5000FFFF, ///< "Media error code end value, not to be used - ///< " - CTL_RESULT_ERROR_DISPLAY_START = 0x48000000, ///< Display error code starting value, not to be used - CTL_RESULT_ERROR_INVALID_AUX_ACCESS_FLAG = 0x48000001, ///< Invalid flag for Aux access - CTL_RESULT_ERROR_INVALID_SHARPNESS_FILTER_FLAG = 0x48000002,///< Invalid flag for Sharpness - CTL_RESULT_ERROR_DISPLAY_NOT_ATTACHED = 0x48000003, ///< Error for Display not attached - CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE = 0x48000004, ///< Error for display attached but not active - CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG = 0x48000005, ///< Error for invalid power optimization flag - CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST = 0x48000006,///< DPST is supported only in DC Mode - CTL_RESULT_ERROR_INVALID_PIXTX_GET_CONFIG_QUERY_TYPE = 0x48000007, ///< Invalid query type for pixel transformation get configuration - CTL_RESULT_ERROR_INVALID_PIXTX_SET_CONFIG_OPERATION_TYPE = 0x48000008, ///< Invalid operation type for pixel transformation set configuration - CTL_RESULT_ERROR_INVALID_SET_CONFIG_NUMBER_OF_SAMPLES = 0x48000009, ///< Invalid number of samples for pixel transformation set configuration - CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID = 0x4800000a, ///< Invalid block id for pixel transformation - CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_TYPE = 0x4800000b, ///< Invalid block type for pixel transformation - CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_NUMBER = 0x4800000c, ///< Invalid block number for pixel transformation - CTL_RESULT_ERROR_INSUFFICIENT_PIXTX_BLOCK_CONFIG_MEMORY = 0x4800000d, ///< Insufficient memery allocated for BlockConfigs - CTL_RESULT_ERROR_3DLUT_INVALID_PIPE = 0x4800000e, ///< Invalid pipe for 3dlut - CTL_RESULT_ERROR_3DLUT_INVALID_DATA = 0x4800000f, ///< Invalid 3dlut data - CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR = 0x48000010, ///< 3dlut not supported in HDR - CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION = 0x48000011, ///< Invalid 3dlut operation - CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL = 0x48000012, ///< 3dlut call unsuccessful - CTL_RESULT_ERROR_AUX_DEFER = 0x48000013, ///< AUX defer failure - CTL_RESULT_ERROR_AUX_TIMEOUT = 0x48000014, ///< AUX timeout failure - CTL_RESULT_ERROR_AUX_INCOMPLETE_WRITE = 0x48000015, ///< AUX incomplete write failure - CTL_RESULT_ERROR_I2C_AUX_STATUS_UNKNOWN = 0x48000016, ///< I2C/AUX unkonown failure - CTL_RESULT_ERROR_I2C_AUX_UNSUCCESSFUL = 0x48000017, ///< I2C/AUX unsuccessful - CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED = 0x48000018,///< Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data - ///< passed by user - CTL_RESULT_ERROR_EXTERNAL_DISPLAY_ATTACHED = 0x48000019,///< External Display is Attached hence fail the Display Switch - CTL_RESULT_ERROR_CUSTOM_MODE_STANDARD_CUSTOM_MODE_EXISTS = 0x4800001a, ///< Standard custom mode exists - CTL_RESULT_ERROR_CUSTOM_MODE_NON_CUSTOM_MATCHING_MODE_EXISTS = 0x4800001b, ///< Non custom matching mode exists - CTL_RESULT_ERROR_CUSTOM_MODE_INSUFFICIENT_MEMORY = 0x4800001c, ///< Custom mode insufficent memory - CTL_RESULT_ERROR_ADAPTER_ALREADY_LINKED = 0x4800001d, ///< Adapter is already linked - CTL_RESULT_ERROR_ADAPTER_NOT_IDENTICAL = 0x4800001e,///< Adapter is not identical for linking - CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY = 0x4800001f, ///< Adapter is LDA Secondary, so not supporting requested operation - CTL_RESULT_ERROR_SET_FBC_FEATURE_NOT_SUPPORTED = 0x48000020,///< Set FBC Feature not supported - CTL_RESULT_ERROR_DISPLAY_END = 0x4800FFFF, ///< "Display error code end value, not to be used - ///< " - CTL_RESULT_MAX - -} ctl_result_t; - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_MAX_DEVICE_NAME_LEN -/// @brief Maximum IPC handle size -#define CTL_MAX_DEVICE_NAME_LEN 100 -#endif // CTL_MAX_DEVICE_NAME_LEN - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_MAX_RESERVED_SIZE -/// @brief Maximum reserved size for future members. -#define CTL_MAX_RESERVED_SIZE 112 -#endif // CTL_MAX_RESERVED_SIZE - -/////////////////////////////////////////////////////////////////////////////// -/// @brief General Physical Units. -typedef enum _ctl_units_t -{ - CTL_UNITS_FREQUENCY_MHZ = 0, ///< Type is Frequency with units in MHz. - CTL_UNITS_OPERATIONS_GTS = 1, ///< Type is Frequency with units in GT/s (gigatransfers per second). - CTL_UNITS_OPERATIONS_MTS = 2, ///< Type is Frequency with units in MT/s (megatransfers per second). - CTL_UNITS_VOLTAGE_VOLTS = 3, ///< Type is Voltage with units in Volts. - CTL_UNITS_POWER_WATTS = 4, ///< Type is Power with units in Watts. - CTL_UNITS_TEMPERATURE_CELSIUS = 5, ///< Type is Temperature with units in Celsius. - CTL_UNITS_ENERGY_JOULES = 6, ///< Type is Energy with units in Joules. - CTL_UNITS_TIME_SECONDS = 7, ///< Type is Time with units in Seconds. - CTL_UNITS_MEMORY_BYTES = 8, ///< Type is Memory with units in Bytes. - CTL_UNITS_ANGULAR_SPEED_RPM = 9, ///< Type is Angular Speed with units in Revolutions per Minute. - CTL_UNITS_POWER_MILLIWATTS = 10, ///< Type is Power with units in MilliWatts. - CTL_UNITS_PERCENT = 11, ///< Type is Percentage. - CTL_UNITS_MEM_SPEED_GBPS = 12, ///< Type is Memory Speed in Gigabyte per Seconds (Gbps) - CTL_UNITS_VOLTAGE_MILLIVOLTS = 13, ///< Type is Voltage with units in milliVolts. - CTL_UNITS_UNKNOWN = 0x4800FFFF, ///< Type of units unknown. - CTL_UNITS_MAX - -} ctl_units_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief General Data Types. -typedef enum _ctl_data_type_t -{ - CTL_DATA_TYPE_INT8 = 0, ///< The data type is 8 bit signed integer. - CTL_DATA_TYPE_UINT8 = 1, ///< The data type is 8 bit unsigned integer. - CTL_DATA_TYPE_INT16 = 2, ///< The data type is 16 bit signed integer. - CTL_DATA_TYPE_UINT16 = 3, ///< The data type is 16 bit unsigned integer. - CTL_DATA_TYPE_INT32 = 4, ///< The data type is 32 bit signed integer. - CTL_DATA_TYPE_UINT32 = 5, ///< The data type is 32 bit unsigned integer. - CTL_DATA_TYPE_INT64 = 6, ///< The data type is 64 bit signed integer. - CTL_DATA_TYPE_UINT64 = 7, ///< The data type is 64 bit unsigned integer. - CTL_DATA_TYPE_FLOAT = 8, ///< The data type is 32 bit floating point. - CTL_DATA_TYPE_DOUBLE = 9, ///< The data type is 64 bit floating point. - CTL_DATA_TYPE_STRING_ASCII = 10, ///< The data type is an array of 8 bit unsigned integers. - CTL_DATA_TYPE_STRING_UTF16 = 11, ///< The data type is an array of 16 bit unsigned integers. - CTL_DATA_TYPE_STRING_UTF132 = 12, ///< The data type is an array of 32 bit unsigned integers. - CTL_DATA_TYPE_UNKNOWN = 0x4800FFFF, ///< The data type is unknown. - CTL_DATA_TYPE_MAX - -} ctl_data_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Union for Generic Data. -/// -/// @details -/// - The telemetry data items could be of different types. -/// - Refer to ::ctl_data_type_t to find the current type. -typedef union _ctl_data_value_t -{ - int8_t data8; ///< [out] The data type is 8 bit signed integer. - uint8_t datau8; ///< [out] The data type is 8 bit unsigned integer. - int16_t data16; ///< [out] The data type is 16 bit signed integer. - uint16_t datau16; ///< [out] The data type is 16 bit unsigned integer. - int32_t data32; ///< [out] The data type is 32 bit signed integer. - uint32_t datau32; ///< [out] The data type is 32 bit unsigned integer. - int64_t data64; ///< [out] The data type is 64 bit signed integer. - uint64_t datau64; ///< [out] The data type is 64 bit unsigned integer. - float datafloat; ///< [out] The data type is 32 bit floating point. - double datadouble; ///< [out] The data type is 64 bit floating point. - -} ctl_data_value_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Base for all properties types -typedef struct _ctl_base_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - -} ctl_base_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Application Unique ID -typedef struct _ctl_application_id_t -{ - uint32_t Data1; ///< [in] Data1 - uint16_t Data2; ///< [in] Data2 - uint16_t Data3; ///< [in] Data3 - uint8_t Data4[8]; ///< [in] Data4 - -} ctl_application_id_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Init arguments -typedef struct _ctl_init_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_version_info_t AppVersion; ///< [in][release] App's IGCL version - ctl_init_flags_t flags; ///< [in][release] Caller version - ctl_version_info_t SupportedVersion; ///< [out][release] IGCL implementation version - ctl_application_id_t ApplicationUID; ///< [in] Application Provided Unique ID.Application can pass all 0's as - ///< the default ID - -} ctl_init_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Reserved struct -typedef struct _ctl_reserved_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - void* pSpecialArg; ///< [in] Reserved struct - uint32_t ArgSize; ///< [in] struct size - -} ctl_reserved_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Reserved base struct -typedef struct _ctl_reserved_args_base_t -{ - ctl_application_id_t ReservedFuncID; ///< [in] Unique ID for reserved/special function - -} ctl_reserved_args_base_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Reserved - Unlock function capability -typedef struct _ctl_unlock_capability_t -{ - ctl_application_id_t ReservedFuncID; ///< [in] Unique ID for reserved/special function - ctl_application_id_t UnlockCapsID; ///< [in] Unique ID to unlock a specific function - -} ctl_unlock_capability_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Used by loader like modules to specify runtime implementation details -typedef struct _ctl_runtime_path_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_application_id_t UnlockID; ///< [in] Unique ID for reserved/special function - wchar_t* pRuntimePath; ///< [in] Path to runtime DLL - uint16_t DeviceID; ///< [in] Device ID of interest to caller. pRuntimePath should not be NULL. - uint8_t RevID; ///< [in] Revision ID of interest to caller. pRuntimePath should not be - ///< NULL. - -} ctl_runtime_path_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Control Api Init -/// -/// @details -/// - Control Api Init -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pInitDesc` -/// + `nullptr == phAPIHandle` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlInit( - ctl_init_args_t* pInitDesc, ///< [in][out] App's control API version - ctl_api_handle_t* phAPIHandle ///< [in][out][release] Control API handle - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Control Api Destroy -/// -/// @details -/// - Control Api Close -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hAPIHandle` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlClose( - ctl_api_handle_t hAPIHandle ///< [in][release] Control API implementation handle obtained during init - ///< call - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Runtime path -/// -/// @details -/// - Control Api set runtime path. Optional call from a loader which allows -/// the loaded runtime to enumerate only the adapters which the specified -/// runtime is responsible for. This is done usually by a loader or by -/// callers who know how to get the specific runtime of interest. This -/// call right now is reserved for use by Intel components. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSetRuntimePath( - ctl_runtime_path_args_t* pArgs ///< [in] Runtime path - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Supported Functions -typedef uint32_t ctl_supported_functions_flags_t; -typedef enum _ctl_supported_functions_flag_t -{ - CTL_SUPPORTED_FUNCTIONS_FLAG_DISPLAY = CTL_BIT(0), ///< [out] Is Display supported - CTL_SUPPORTED_FUNCTIONS_FLAG_3D = CTL_BIT(1), ///< [out] Is 3D supported - CTL_SUPPORTED_FUNCTIONS_FLAG_MEDIA = CTL_BIT(2),///< [out] Is Media supported - CTL_SUPPORTED_FUNCTIONS_FLAG_MAX = 0x80000000 - -} ctl_supported_functions_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Firmware version -typedef struct _ctl_firmware_version_t -{ - uint64_t major_version; ///< [out] Major version - uint64_t minor_version; ///< [out] Minor version - uint64_t build_number; ///< [out] Build number - -} ctl_firmware_version_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief DeviceType -typedef enum _ctl_device_type_t -{ - CTL_DEVICE_TYPE_GRAPHICS = 1, ///< Graphics Device type - CTL_DEVICE_TYPE_SYSTEM = 2, ///< System Device type - CTL_DEVICE_TYPE_MAX - -} ctl_device_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Adapter Properties -typedef uint32_t ctl_adapter_properties_flags_t; -typedef enum _ctl_adapter_properties_flag_t -{ - CTL_ADAPTER_PROPERTIES_FLAG_INTEGRATED = CTL_BIT(0),///< [out] Is Integrated Graphics adapter - CTL_ADAPTER_PROPERTIES_FLAG_LDA_PRIMARY = CTL_BIT(1), ///< [out] Is Primary (Lead) adapter in a Linked Display Adapter (LDA) - ///< chain - CTL_ADAPTER_PROPERTIES_FLAG_LDA_SECONDARY = CTL_BIT(2), ///< [out] Is Secondary (Linked) adapter in a Linked Display Adapter (LDA) - ///< chain - CTL_ADAPTER_PROPERTIES_FLAG_MAX = 0x80000000 - -} ctl_adapter_properties_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Adapter Pci Bus, Device, Function -typedef struct _ctl_adapter_bdf_t -{ - uint8_t bus; ///< [out] PCI Bus Number - uint8_t device; ///< [out] PCI device number - uint8_t function; ///< [out] PCI function - -} ctl_adapter_bdf_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Device Adapter properties -typedef struct _ctl_device_adapter_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - void* pDeviceID; ///< [in,out] OS specific Device ID - uint32_t device_id_size; ///< [in] size of the device ID - ctl_device_type_t device_type; ///< [out] Device Type - ctl_supported_functions_flags_t supported_subfunction_flags;///< [out] Supported functions - uint64_t driver_version; ///< [out] Driver version - ctl_firmware_version_t firmware_version; ///< [out] Firmware version - uint32_t pci_vendor_id; ///< [out] PCI Vendor ID - uint32_t pci_device_id; ///< [out] PCI Device ID - uint32_t rev_id; ///< [out] PCI Revision ID - uint32_t num_eus_per_sub_slice; ///< [out] Number of EUs per sub-slice - uint32_t num_sub_slices_per_slice; ///< [out] Number of sub-slices per slice - uint32_t num_slices; ///< [out] Number of slices - char name[CTL_MAX_DEVICE_NAME_LEN]; ///< [out] Device name - ctl_adapter_properties_flags_t graphics_adapter_properties; ///< [out] Graphics Adapter Properties - uint32_t Frequency; ///< [out] Clock frequency for this device. Supported only for Version > 0 - uint16_t pci_subsys_id; ///< [out] PCI SubSys ID, Supported only for Version > 1 - uint16_t pci_subsys_vendor_id; ///< [out] PCI SubSys Vendor ID, Supported only for Version > 1 - ctl_adapter_bdf_t adapter_bdf; ///< [out] Pci Bus, Device, Function. Supported only for Version > 1 - char reserved[CTL_MAX_RESERVED_SIZE]; ///< [out] Reserved - -} ctl_device_adapter_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief OperationType -typedef enum _ctl_operation_type_t -{ - CTL_OPERATION_TYPE_READ = 1, ///< Read operation - CTL_OPERATION_TYPE_WRITE = 2, ///< Write operation - CTL_OPERATION_TYPE_MAX - -} ctl_operation_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Generic Structure for Void* datatypes -typedef struct _ctl_generic_void_datatype_t -{ - void* pData; ///< [in,out]void pointer to memory - uint32_t size; ///< [in,out]size of the allocated memory - -} ctl_generic_void_datatype_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Generic Structure for Revision datatypes -typedef struct _ctl_revision_datatype_t -{ - uint8_t major_version; ///< [in,out]Major Version - uint8_t minor_version; ///< [in,out]Minor Version - uint8_t revision_version; ///< [in,out]Revision Version - -} ctl_revision_datatype_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Property Type flags -typedef uint32_t ctl_property_type_flags_t; -typedef enum _ctl_property_type_flag_t -{ - CTL_PROPERTY_TYPE_FLAG_DISPLAY = CTL_BIT(0), ///< Display type. Supported scenarios: Sharpness/gamma/CSC - CTL_PROPERTY_TYPE_FLAG_3D = CTL_BIT(1), ///< 3D type. Supported scenarios: All set calls via IGCL's 3D APIs - CTL_PROPERTY_TYPE_FLAG_MEDIA = CTL_BIT(2), ///< Media type. Supported scenarios: All set calls via IGCL's media APIs - CTL_PROPERTY_TYPE_FLAG_CORE = CTL_BIT(3), ///< For future: Core graphic event types like clocking, frequency etc. - CTL_PROPERTY_TYPE_FLAG_MAX = 0x80000000 - -} ctl_property_type_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Arguments related to wait for a property change function -typedef struct _ctl_wait_property_change_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_property_type_flags_t PropertyType; ///< [in] Type of the property - uint32_t TimeOutMilliSec; ///< [in][release] Time-out interval in milliseconds. Specify 0xFFFFFFFF if - ///< time-out is not desired - uint32_t EventMiscFlags; ///< [in][release] Event flags for future use - void* pReserved; ///< [in][release] Reserved for future use - uint64_t ReservedOutFlags; ///< [out] Reserved out argument for future use - -} ctl_wait_property_change_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Display orientation (rotation) -typedef enum _ctl_display_orientation_t -{ - CTL_DISPLAY_ORIENTATION_0 = 0, ///< 0 Degree - CTL_DISPLAY_ORIENTATION_90 = 1, ///< 90 Degree - CTL_DISPLAY_ORIENTATION_180 = 2, ///< 180 Degree - CTL_DISPLAY_ORIENTATION_270 = 3, ///< 270 Degree - CTL_DISPLAY_ORIENTATION_MAX - -} ctl_display_orientation_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Rectangle -typedef struct _ctl_rect_t -{ - int32_t Left; ///< [in,out] Left - int32_t Top; ///< [in,out] Top - int32_t Right; ///< [in,out] Right - int32_t Bottom; ///< [in,out] Bottom - -} ctl_rect_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Wait for a property change. Note that this is a blocking call -/// -/// @details -/// - Wait for a property change in display, 3d, media etc. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceAdapter` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlWaitForPropertyChange( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter - ctl_wait_property_change_args_t* pArgs ///< [in] Argument containing information about which property changes to - ///< listen for - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Reserved function -/// -/// @details -/// - Reserved function -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceAdapter` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlReservedCall( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter - ctl_reserved_args_t* pArgs ///< [in] Argument containing information - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_base_interface_t -typedef struct _ctl_base_interface_t ctl_base_interface_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_range_info_t -typedef struct _ctl_property_range_info_t ctl_property_range_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_range_info_int_t -typedef struct _ctl_property_range_info_int_t ctl_property_range_info_int_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_range_info_uint_t -typedef struct _ctl_property_range_info_uint_t ctl_property_range_info_uint_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_info_boolean_t -typedef struct _ctl_property_info_boolean_t ctl_property_info_boolean_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_boolean_t -typedef struct _ctl_property_boolean_t ctl_property_boolean_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_info_enum_t -typedef struct _ctl_property_info_enum_t ctl_property_info_enum_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_enum_t -typedef struct _ctl_property_enum_t ctl_property_enum_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_info_float_t -typedef struct _ctl_property_info_float_t ctl_property_info_float_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_float_t -typedef struct _ctl_property_float_t ctl_property_float_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_info_int_t -typedef struct _ctl_property_info_int_t ctl_property_info_int_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_int_t -typedef struct _ctl_property_int_t ctl_property_int_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_info_uint_t -typedef struct _ctl_property_info_uint_t ctl_property_info_uint_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_property_uint_t -typedef struct _ctl_property_uint_t ctl_property_uint_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_base_properties_t -typedef struct _ctl_base_properties_t ctl_base_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_application_id_t -typedef struct _ctl_application_id_t ctl_application_id_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_init_args_t -typedef struct _ctl_init_args_t ctl_init_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_reserved_args_t -typedef struct _ctl_reserved_args_t ctl_reserved_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_reserved_args_base_t -typedef struct _ctl_reserved_args_base_t ctl_reserved_args_base_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_unlock_capability_t -typedef struct _ctl_unlock_capability_t ctl_unlock_capability_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_runtime_path_args_t -typedef struct _ctl_runtime_path_args_t ctl_runtime_path_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_firmware_version_t -typedef struct _ctl_firmware_version_t ctl_firmware_version_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_adapter_bdf_t -typedef struct _ctl_adapter_bdf_t ctl_adapter_bdf_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_device_adapter_properties_t -typedef struct _ctl_device_adapter_properties_t ctl_device_adapter_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_generic_void_datatype_t -typedef struct _ctl_generic_void_datatype_t ctl_generic_void_datatype_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_revision_datatype_t -typedef struct _ctl_revision_datatype_t ctl_revision_datatype_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_wait_property_change_args_t -typedef struct _ctl_wait_property_change_args_t ctl_wait_property_change_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_rect_t -typedef struct _ctl_rect_t ctl_rect_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_endurance_gaming_caps_t -typedef struct _ctl_endurance_gaming_caps_t ctl_endurance_gaming_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_endurance_gaming_t -typedef struct _ctl_endurance_gaming_t ctl_endurance_gaming_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_endurance_gaming2_t -typedef struct _ctl_endurance_gaming2_t ctl_endurance_gaming2_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_adaptivesync_caps_t -typedef struct _ctl_adaptivesync_caps_t ctl_adaptivesync_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_adaptivesync_getset_t -typedef struct _ctl_adaptivesync_getset_t ctl_adaptivesync_getset_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_3d_app_profiles_caps_t -typedef struct _ctl_3d_app_profiles_caps_t ctl_3d_app_profiles_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_3d_app_profiles_t -typedef struct _ctl_3d_app_profiles_t ctl_3d_app_profiles_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_3d_tier_details_t -typedef struct _ctl_3d_tier_details_t ctl_3d_tier_details_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_3d_feature_details_t -typedef struct _ctl_3d_feature_details_t ctl_3d_feature_details_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_3d_feature_caps_t -typedef struct _ctl_3d_feature_caps_t ctl_3d_feature_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_3d_feature_getset_t -typedef struct _ctl_3d_feature_getset_t ctl_3d_feature_getset_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_kmd_load_features_t -typedef struct _ctl_kmd_load_features_t ctl_kmd_load_features_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_display_timing_t -typedef struct _ctl_display_timing_t ctl_display_timing_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_display_properties_t -typedef struct _ctl_display_properties_t ctl_display_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_adapter_display_encoder_properties_t -typedef struct _ctl_adapter_display_encoder_properties_t ctl_adapter_display_encoder_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_sharpness_filter_properties_t -typedef struct _ctl_sharpness_filter_properties_t ctl_sharpness_filter_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_sharpness_caps_t -typedef struct _ctl_sharpness_caps_t ctl_sharpness_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_sharpness_settings_t -typedef struct _ctl_sharpness_settings_t ctl_sharpness_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_i2c_access_args_t -typedef struct _ctl_i2c_access_args_t ctl_i2c_access_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_i2c_access_pinpair_args_t -typedef struct _ctl_i2c_access_pinpair_args_t ctl_i2c_access_pinpair_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_aux_access_args_t -typedef struct _ctl_aux_access_args_t ctl_aux_access_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_optimization_caps_t -typedef struct _ctl_power_optimization_caps_t ctl_power_optimization_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_optimization_lrr_t -typedef struct _ctl_power_optimization_lrr_t ctl_power_optimization_lrr_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_optimization_psr_t -typedef struct _ctl_power_optimization_psr_t ctl_power_optimization_psr_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_optimization_dpst_t -typedef struct _ctl_power_optimization_dpst_t ctl_power_optimization_dpst_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_optimization_settings_t -typedef struct _ctl_power_optimization_settings_t ctl_power_optimization_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_set_brightness_t -typedef struct _ctl_set_brightness_t ctl_set_brightness_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_get_brightness_t -typedef struct _ctl_get_brightness_t ctl_get_brightness_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pixtx_color_primaries_t -typedef struct _ctl_pixtx_color_primaries_t ctl_pixtx_color_primaries_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pixtx_pixel_format_t -typedef struct _ctl_pixtx_pixel_format_t ctl_pixtx_pixel_format_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pixtx_1dlut_config_t -typedef struct _ctl_pixtx_1dlut_config_t ctl_pixtx_1dlut_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pixtx_matrix_config_t -typedef struct _ctl_pixtx_matrix_config_t ctl_pixtx_matrix_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pixtx_3dlut_sample_t -typedef struct _ctl_pixtx_3dlut_sample_t ctl_pixtx_3dlut_sample_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pixtx_3dlut_config_t -typedef struct _ctl_pixtx_3dlut_config_t ctl_pixtx_3dlut_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pixtx_block_config_t -typedef struct _ctl_pixtx_block_config_t ctl_pixtx_block_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pixtx_pipe_get_config_t -typedef struct _ctl_pixtx_pipe_get_config_t ctl_pixtx_pipe_get_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pixtx_pipe_set_config_t -typedef struct _ctl_pixtx_pipe_set_config_t ctl_pixtx_pipe_set_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_panel_descriptor_access_args_t -typedef struct _ctl_panel_descriptor_access_args_t ctl_panel_descriptor_access_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_retro_scaling_settings_t -typedef struct _ctl_retro_scaling_settings_t ctl_retro_scaling_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_retro_scaling_caps_t -typedef struct _ctl_retro_scaling_caps_t ctl_retro_scaling_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_scaling_caps_t -typedef struct _ctl_scaling_caps_t ctl_scaling_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_scaling_settings_t -typedef struct _ctl_scaling_settings_t ctl_scaling_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_lace_lux_aggr_map_entry_t -typedef struct _ctl_lace_lux_aggr_map_entry_t ctl_lace_lux_aggr_map_entry_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_lace_lux_aggr_map_t -typedef struct _ctl_lace_lux_aggr_map_t ctl_lace_lux_aggr_map_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_lace_config_t -typedef struct _ctl_lace_config_t ctl_lace_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_sw_psr_settings_t -typedef struct _ctl_sw_psr_settings_t ctl_sw_psr_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_intel_arc_sync_monitor_params_t -typedef struct _ctl_intel_arc_sync_monitor_params_t ctl_intel_arc_sync_monitor_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_mux_properties_t -typedef struct _ctl_mux_properties_t ctl_mux_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_intel_arc_sync_profile_params_t -typedef struct _ctl_intel_arc_sync_profile_params_t ctl_intel_arc_sync_profile_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_edid_management_args_t -typedef struct _ctl_edid_management_args_t ctl_edid_management_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_get_set_custom_mode_args_t -typedef struct _ctl_get_set_custom_mode_args_t ctl_get_set_custom_mode_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_custom_src_mode_t -typedef struct _ctl_custom_src_mode_t ctl_custom_src_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_child_display_target_mode_t -typedef struct _ctl_child_display_target_mode_t ctl_child_display_target_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_combined_display_child_info_t -typedef struct _ctl_combined_display_child_info_t ctl_combined_display_child_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_combined_display_args_t -typedef struct _ctl_combined_display_args_t ctl_combined_display_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_genlock_display_info_t -typedef struct _ctl_genlock_display_info_t ctl_genlock_display_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_genlock_target_mode_list_t -typedef struct _ctl_genlock_target_mode_list_t ctl_genlock_target_mode_list_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_genlock_topology_t -typedef struct _ctl_genlock_topology_t ctl_genlock_topology_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_genlock_args_t -typedef struct _ctl_genlock_args_t ctl_genlock_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_vblank_ts_args_t -typedef struct _ctl_vblank_ts_args_t ctl_vblank_ts_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_lda_args_t -typedef struct _ctl_lda_args_t ctl_lda_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_dce_args_t -typedef struct _ctl_dce_args_t ctl_dce_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_wire_format_t -typedef struct _ctl_wire_format_t ctl_wire_format_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_get_set_wire_format_config_t -typedef struct _ctl_get_set_wire_format_config_t ctl_get_set_wire_format_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_display_settings_t -typedef struct _ctl_display_settings_t ctl_display_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_engine_properties_t -typedef struct _ctl_engine_properties_t ctl_engine_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_engine_stats_t -typedef struct _ctl_engine_stats_t ctl_engine_stats_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_fan_speed_t -typedef struct _ctl_fan_speed_t ctl_fan_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_fan_temp_speed_t -typedef struct _ctl_fan_temp_speed_t ctl_fan_temp_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_fan_speed_table_t -typedef struct _ctl_fan_speed_table_t ctl_fan_speed_table_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_fan_properties_t -typedef struct _ctl_fan_properties_t ctl_fan_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_fan_config_t -typedef struct _ctl_fan_config_t ctl_fan_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_freq_properties_t -typedef struct _ctl_freq_properties_t ctl_freq_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_freq_range_t -typedef struct _ctl_freq_range_t ctl_freq_range_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_freq_state_t -typedef struct _ctl_freq_state_t ctl_freq_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_freq_throttle_time_t -typedef struct _ctl_freq_throttle_time_t ctl_freq_throttle_time_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_super_resolution_info_t -typedef struct _ctl_video_processing_super_resolution_info_t ctl_video_processing_super_resolution_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_super_resolution_t -typedef struct _ctl_video_processing_super_resolution_t ctl_video_processing_super_resolution_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_noise_reduction_info_t -typedef struct _ctl_video_processing_noise_reduction_info_t ctl_video_processing_noise_reduction_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_noise_reduction_t -typedef struct _ctl_video_processing_noise_reduction_t ctl_video_processing_noise_reduction_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_adaptive_contrast_enhancement_info_t -typedef struct _ctl_video_processing_adaptive_contrast_enhancement_info_t ctl_video_processing_adaptive_contrast_enhancement_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_adaptive_contrast_enhancement_t -typedef struct _ctl_video_processing_adaptive_contrast_enhancement_t ctl_video_processing_adaptive_contrast_enhancement_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_standard_color_correction_info_t -typedef struct _ctl_video_processing_standard_color_correction_info_t ctl_video_processing_standard_color_correction_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_standard_color_correction_t -typedef struct _ctl_video_processing_standard_color_correction_t ctl_video_processing_standard_color_correction_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_total_color_correction_info_t -typedef struct _ctl_video_processing_total_color_correction_info_t ctl_video_processing_total_color_correction_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_total_color_correction_t -typedef struct _ctl_video_processing_total_color_correction_t ctl_video_processing_total_color_correction_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_feature_details_t -typedef struct _ctl_video_processing_feature_details_t ctl_video_processing_feature_details_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_feature_caps_t -typedef struct _ctl_video_processing_feature_caps_t ctl_video_processing_feature_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_video_processing_feature_getset_t -typedef struct _ctl_video_processing_feature_getset_t ctl_video_processing_feature_getset_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_mem_properties_t -typedef struct _ctl_mem_properties_t ctl_mem_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_mem_state_t -typedef struct _ctl_mem_state_t ctl_mem_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_mem_bandwidth_t -typedef struct _ctl_mem_bandwidth_t ctl_mem_bandwidth_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_oc_telemetry_item_t -typedef struct _ctl_oc_telemetry_item_t ctl_oc_telemetry_item_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_oc_control_info_t -typedef struct _ctl_oc_control_info_t ctl_oc_control_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_oc_properties_t -typedef struct _ctl_oc_properties_t ctl_oc_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_oc_vf_pair_t -typedef struct _ctl_oc_vf_pair_t ctl_oc_vf_pair_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_psu_info_t -typedef struct _ctl_psu_info_t ctl_psu_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_telemetry_t -typedef struct _ctl_power_telemetry_t ctl_power_telemetry_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pci_address_t -typedef struct _ctl_pci_address_t ctl_pci_address_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pci_speed_t -typedef struct _ctl_pci_speed_t ctl_pci_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pci_properties_t -typedef struct _ctl_pci_properties_t ctl_pci_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_pci_state_t -typedef struct _ctl_pci_state_t ctl_pci_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_properties_t -typedef struct _ctl_power_properties_t ctl_power_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_energy_counter_t -typedef struct _ctl_power_energy_counter_t ctl_power_energy_counter_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_sustained_limit_t -typedef struct _ctl_power_sustained_limit_t ctl_power_sustained_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_burst_limit_t -typedef struct _ctl_power_burst_limit_t ctl_power_burst_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_peak_limit_t -typedef struct _ctl_power_peak_limit_t ctl_power_peak_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_power_limits_t -typedef struct _ctl_power_limits_t ctl_power_limits_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_energy_threshold_t -typedef struct _ctl_energy_threshold_t ctl_energy_threshold_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_temp_properties_t -typedef struct _ctl_temp_properties_t ctl_temp_properties_t; - - - -#if !defined(__GNUC__) -#pragma endregion // common -#endif -// Intel 'ctlApi' for Device Adapter -#if !defined(__GNUC__) -#pragma region _3D -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Feature type -typedef enum _ctl_3d_feature_t -{ - CTL_3D_FEATURE_FRAME_PACING = 0, ///< Frame pacing. Contains generic enum type fields - CTL_3D_FEATURE_ENDURANCE_GAMING = 1, ///< Endurance gaming. Contains generic integer type fields. Value will be - ///< interpreted as the max FPS to be used when in DC mode globally or per - ///< application - CTL_3D_FEATURE_FRAME_LIMIT = 2, ///< Frame limit for games. Contains generic integer type fields. Value - ///< will be interpreted as the max FPS to be used independent of system - ///< power state - CTL_3D_FEATURE_ANISOTROPIC = 3, ///< ANISOTROPIC. Contains generic enum type fields - CTL_3D_FEATURE_CMAA = 4, ///< CMAA. Contains generic enum type fields - CTL_3D_FEATURE_TEXTURE_FILTERING_QUALITY = 5, ///< Texture filtering quality. Contains generic enum type fields - CTL_3D_FEATURE_ADAPTIVE_TESSELLATION = 6, ///< Adaptive tessellation quality. Contains generic integer type fields - CTL_3D_FEATURE_SHARPENING_FILTER = 7, ///< Sharpening Filter. Contains generic integer type fields - CTL_3D_FEATURE_MSAA = 8, ///< Msaa. Contains generic enum type fields - CTL_3D_FEATURE_GAMING_FLIP_MODES = 9, ///< Various Gaming flip modes like speed frame, smooth sync & force async - ///< flip. Contains generic enum type fields - CTL_3D_FEATURE_ADAPTIVE_SYNC_PLUS = 10, ///< Adaptive sync plus. Refer custom field ::ctl_adaptivesync_caps_t & - ///< ::ctl_adaptivesync_getset_t - CTL_3D_FEATURE_APP_PROFILES = 11, ///< Game Compatibility & Performance Profiles. Refer custom field - ///< ::ctl_3d_app_profiles_caps_t & ::ctl_3d_app_profiles_t - CTL_3D_FEATURE_APP_PROFILE_DETAILS = 12, ///< Game Profile Customization. Refer custom field ::ctl_3d_tier_details_t - CTL_3D_FEATURE_EMULATED_TYPED_64BIT_ATOMICS = 13, ///< Emulated Typed 64bit Atomics support in DG2 - CTL_3D_FEATURE_VRR_WINDOWED_BLT = 14, ///< VRR windowed blt. Control VRR for windowed mode game - CTL_3D_FEATURE_GLOBAL_OR_PER_APP = 15, ///< Set global settings or per application settings - CTL_3D_FEATURE_MAX - -} ctl_3d_feature_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief 3D feature misc flags -typedef uint32_t ctl_3d_feature_misc_flags_t; -typedef enum _ctl_3d_feature_misc_flag_t -{ - CTL_3D_FEATURE_MISC_FLAG_DX11 = CTL_BIT(0), ///< Feature supported on DX11 - CTL_3D_FEATURE_MISC_FLAG_DX12 = CTL_BIT(1), ///< Feature supported on DX12 - CTL_3D_FEATURE_MISC_FLAG_VULKAN = CTL_BIT(2), ///< Feature supported on VULKAN - CTL_3D_FEATURE_MISC_FLAG_LIVE_CHANGE = CTL_BIT(3), ///< User can change feature live without restarting the game - CTL_3D_FEATURE_MISC_FLAG_MAX = 0x80000000 - -} ctl_3d_feature_misc_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Anisotropic values possible -typedef enum _ctl_3d_anisotropic_types_t -{ - CTL_3D_ANISOTROPIC_TYPES_APP_CHOICE = 0, ///< Application choice - CTL_3D_ANISOTROPIC_TYPES_2X = 2, ///< 2X - CTL_3D_ANISOTROPIC_TYPES_4X = 4, ///< 4X - CTL_3D_ANISOTROPIC_TYPES_8X = 8, ///< 8X - CTL_3D_ANISOTROPIC_TYPES_16X = 16, ///< 16X - CTL_3D_ANISOTROPIC_TYPES_MAX - -} ctl_3d_anisotropic_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Texture filtering values possible -typedef enum _ctl_3d_texture_filtering_quality_types_t -{ - CTL_3D_TEXTURE_FILTERING_QUALITY_TYPES_PERFORMANCE = 0, ///< Performance - CTL_3D_TEXTURE_FILTERING_QUALITY_TYPES_BALANCED = 1,///< Balanced - CTL_3D_TEXTURE_FILTERING_QUALITY_TYPES_QUALITY = 2, ///< Quality - CTL_3D_TEXTURE_FILTERING_QUALITY_TYPES_MAX - -} ctl_3d_texture_filtering_quality_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frame pacing values possible -typedef enum _ctl_3d_frame_pacing_types_t -{ - CTL_3D_FRAME_PACING_TYPES_DISABLE = 0, ///< Disable - CTL_3D_FRAME_PACING_TYPES_ENABLE_MODE_FRAME_NO_SMOOTHENING = 1, ///< Enable with scheduler without any frame smoothening - CTL_3D_FRAME_PACING_TYPES_ENABLE_MODE_FRAME_MAX_SMOOTHENING = 2,///< Enable with scheduler with maximum smoothness - CTL_3D_FRAME_PACING_TYPES_ENABLE_MODE_COMPETITIVE_GAMING = 3, ///< Enable with scheduler in competitive gaming mode - CTL_3D_FRAME_PACING_TYPES_MAX - -} ctl_3d_frame_pacing_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Endurance Gaming control possible -typedef enum _ctl_3d_endurance_gaming_control_t -{ - CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_OFF = 0, ///< Endurance Gaming disable - CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_ON = 1, ///< Endurance Gaming enable - CTL_3D_ENDURANCE_GAMING_CONTROL_AUTO = 2, ///< Endurance Gaming auto - CTL_3D_ENDURANCE_GAMING_CONTROL_MAX - -} ctl_3d_endurance_gaming_control_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Endurance Gaming modes possible -typedef enum _ctl_3d_endurance_gaming_mode_t -{ - CTL_3D_ENDURANCE_GAMING_MODE_BETTER_PERFORMANCE = 0,///< Endurance Gaming better performance mode - CTL_3D_ENDURANCE_GAMING_MODE_BALANCED = 1, ///< Endurance Gaming balanced mode - CTL_3D_ENDURANCE_GAMING_MODE_MAXIMUM_BATTERY = 2, ///< Endurance Gaming maximum battery mode - CTL_3D_ENDURANCE_GAMING_MODE_MAX - -} ctl_3d_endurance_gaming_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Cmaa values possible -typedef enum _ctl_3d_cmaa_types_t -{ - CTL_3D_CMAA_TYPES_TURN_OFF = 0, ///< Turn off - CTL_3D_CMAA_TYPES_OVERRIDE_MSAA = 1, ///< Override MSAA - CTL_3D_CMAA_TYPES_ENHANCE_APPLICATION = 2, ///< Enhance Application - CTL_3D_CMAA_TYPES_MAX - -} ctl_3d_cmaa_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Adaptive Tessellation -typedef enum _ctl_3d_adaptive_tessellation_types_t -{ - CTL_3D_ADAPTIVE_TESSELLATION_TYPES_TURN_OFF = 0,///< Turn off - CTL_3D_ADAPTIVE_TESSELLATION_TYPES_TURN_ON = 1, ///< Turn on - CTL_3D_ADAPTIVE_TESSELLATION_TYPES_MAX - -} ctl_3d_adaptive_tessellation_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Sharpening filter values possible -typedef enum _ctl_3d_sharpening_filter_types_t -{ - CTL_3D_SHARPENING_FILTER_TYPES_TURN_OFF = 0, ///< Turn off - CTL_3D_SHARPENING_FILTER_TYPES_TURN_ON = 1, ///< Turn on - CTL_3D_SHARPENING_FILTER_TYPES_MAX - -} ctl_3d_sharpening_filter_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief MSAA values possible -typedef enum _ctl_3d_msaa_types_t -{ - CTL_3D_MSAA_TYPES_APP_CHOICE = 0, ///< Application choice - CTL_3D_MSAA_TYPES_DISABLED = 1, ///< Disabled. MSAA count 1 - CTL_3D_MSAA_TYPES_2X = 2, ///< 2X - CTL_3D_MSAA_TYPES_4X = 4, ///< 4X - CTL_3D_MSAA_TYPES_8X = 8, ///< 8X - CTL_3D_MSAA_TYPES_16X = 16, ///< 16X - CTL_3D_MSAA_TYPES_MAX - -} ctl_3d_msaa_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Gaming flip modes -typedef uint32_t ctl_gaming_flip_mode_flags_t; -typedef enum _ctl_gaming_flip_mode_flag_t -{ - CTL_GAMING_FLIP_MODE_FLAG_APPLICATION_DEFAULT = CTL_BIT(0), ///< Application Default - CTL_GAMING_FLIP_MODE_FLAG_VSYNC_OFF = CTL_BIT(1), ///< Convert all sync flips to async on the next possible scanline. - CTL_GAMING_FLIP_MODE_FLAG_VSYNC_ON = CTL_BIT(2),///< Convert all async flips to sync flips. - CTL_GAMING_FLIP_MODE_FLAG_SMOOTH_SYNC = CTL_BIT(3), ///< Reduce tearing effect with async flips - CTL_GAMING_FLIP_MODE_FLAG_SPEED_FRAME = CTL_BIT(4), ///< Application unaware triple buffering - CTL_GAMING_FLIP_MODE_FLAG_CAPPED_FPS = CTL_BIT(5), ///< Limit the game FPS to panel RR - CTL_GAMING_FLIP_MODE_FLAG_MAX = 0x80000000 - -} ctl_gaming_flip_mode_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Endurance Gaming caps -typedef struct _ctl_endurance_gaming_caps_t -{ - ctl_property_info_enum_t EGControlCaps; ///< [out] Endurance Gaming control capability - ctl_property_info_enum_t EGModeCaps; ///< [out] Endurance Gaming mode capability - -} ctl_endurance_gaming_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Endurance Gaming Get/Set -typedef struct _ctl_endurance_gaming_t -{ - ctl_3d_endurance_gaming_control_t EGControl; ///< [in,out] Endurance Gaming control - Off/On/Auto - ctl_3d_endurance_gaming_mode_t EGMode; ///< [in,out] Endurance Gaming mode - Better Performance/Balanced/Maximum - ///< Battery - -} ctl_endurance_gaming_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Endurance Gaming version2 Get/Set -typedef struct _ctl_endurance_gaming2_t -{ - ctl_3d_endurance_gaming_control_t EGControl; ///< [in,out] Endurance Gaming control - Off/On/Auto - ctl_3d_endurance_gaming_mode_t EGMode; ///< [in,out] Endurance Gaming mode - Better Performance/Balanced/Maximum - ///< Battery - bool IsFPRequired; ///< [out] Is frame pacing required, dynamic state - double TargetFPS; ///< [out] Target FPS for frame pacing - double RefreshRate; ///< [out] Refresh rate used to calculate target fps - uint32_t Reserved[4]; ///< [out] Reserved fields - -} ctl_endurance_gaming2_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Adaptive sync plus caps -typedef struct _ctl_adaptivesync_caps_t -{ - bool AdaptiveBalanceSupported; ///< [out] Adaptive balance supported - ctl_property_info_float_t AdaptiveBalanceStrengthCaps; ///< [out] Strength of adaptive balance algorithm - min/max/steps/default - -} ctl_adaptivesync_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Adaptive sync plus -typedef struct _ctl_adaptivesync_getset_t -{ - bool AdaptiveSync; ///< [in,out] Adaptive sync. Note that in Windows, OS controls state of - ///< adaptive sync and which game gets the feature using it's own policies - bool AdaptiveBalance; ///< [in,out] Adaptive balance - bool AllowAsyncForHighFPS; ///< [in,out] Allow async flips when FPS is higher than max refresh rate of - ///< the panel - float AdaptiveBalanceStrength; ///< [in,out] Adaptive balance strength - -} ctl_adaptivesync_getset_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Game tier types -typedef uint32_t ctl_3d_tier_type_flags_t; -typedef enum _ctl_3d_tier_type_flag_t -{ - CTL_3D_TIER_TYPE_FLAG_COMPATIBILITY = CTL_BIT(0), ///< Compatibility Tier - CTL_3D_TIER_TYPE_FLAG_PERFORMANCE = CTL_BIT(1), ///< Performance Tier - CTL_3D_TIER_TYPE_FLAG_MAX = 0x80000000 - -} ctl_3d_tier_type_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Game tiers -typedef uint32_t ctl_3d_tier_profile_flags_t; -typedef enum _ctl_3d_tier_profile_flag_t -{ - CTL_3D_TIER_PROFILE_FLAG_TIER_1 = CTL_BIT(0), ///< Tier 1 Profile - CTL_3D_TIER_PROFILE_FLAG_TIER_2 = CTL_BIT(1), ///< Tier 2 Profile - CTL_3D_TIER_PROFILE_FLAG_TIER_RECOMMENDED = CTL_BIT(30),///< Recommended Tier Profile. If set other tier values shouldn't be set - CTL_3D_TIER_PROFILE_FLAG_MAX = 0x80000000 - -} ctl_3d_tier_profile_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Game Profile Capabilities. Typically these remain the same across -/// games. -typedef struct _ctl_3d_app_profiles_caps_t -{ - ctl_3d_tier_type_flags_t SupportedTierTypes; ///< [out] Tier of interest for capability check - uint64_t Reserved; ///< [in,out] Reserved for future - -} ctl_3d_app_profiles_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Game Profile tiers -typedef struct _ctl_3d_app_profiles_t -{ - ctl_3d_tier_type_flag_t TierType; ///< [in] Tier type - ctl_3d_tier_profile_flags_t SupportedTierProfiles; ///< [out] Supported tier profiles bitmask - ctl_3d_tier_profile_flags_t DefaultEnabledTierProfiles; ///< [out] Default tiers which driver will enable if there is no user - ///< specific setting for global or per application - ctl_3d_tier_profile_flags_t CustomizationSupportedTierProfiles; ///< [out] Tiers supporting customization - reserved for future - ctl_3d_tier_profile_flags_t EnabledTierProfiles;///< [in,out] Tier profile(s) to be enabled/disabled in the case of a set - ///< call. For a get call this will return the currently enabled tiers - ctl_3d_tier_profile_flags_t CustomizationEnabledTierProfiles; ///< [in,out] Tier profile(s) which are customized. Caller shall call - ///< ::ctl_3d_tier_details_t to get specifics if any. - uint64_t Reserved; ///< [in,out] Reserved for future - -} ctl_3d_app_profiles_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Game Profile tiers details -typedef struct _ctl_3d_tier_details_t -{ - ctl_3d_tier_type_flag_t TierType; ///< [in] Tier type - ctl_3d_tier_profile_flag_t TierProfile; ///< [in] Tier profile(s) for get/set details - uint64_t Reserved[4]; ///< [in,out] Reserved for future - -} ctl_3d_tier_details_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Emulated Typed 64bit Atomics -typedef enum _ctl_emulated_typed_64bit_atomics_types_t -{ - CTL_EMULATED_TYPED_64BIT_ATOMICS_TYPES_DEFAULT = 0, ///< Default settings is based on workload/driver decision. - CTL_EMULATED_TYPED_64BIT_ATOMICS_TYPES_TURN_ON = 1, ///< Force Turn on - CTL_EMULATED_TYPED_64BIT_ATOMICS_TYPES_TURN_OFF = 2,///< Force Turn off - CTL_EMULATED_TYPED_64BIT_ATOMICS_TYPES_MAX - -} ctl_emulated_typed_64bit_atomics_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief VRR windowed BLT control possible. Reserved functionality -typedef enum _ctl_3d_vrr_windowed_blt_reserved_t -{ - CTL_3D_VRR_WINDOWED_BLT_RESERVED_AUTO = 0, ///< VRR windowed BLT auto - CTL_3D_VRR_WINDOWED_BLT_RESERVED_TURN_ON = 1, ///< VRR windowed BLT enable - CTL_3D_VRR_WINDOWED_BLT_RESERVED_TURN_OFF = 2, ///< VRR windowed BLT disable - CTL_3D_VRR_WINDOWED_BLT_RESERVED_MAX - -} ctl_3d_vrr_windowed_blt_reserved_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Global or per app values possible -typedef enum _ctl_3d_global_or_per_app_types_t -{ - CTL_3D_GLOBAL_OR_PER_APP_TYPES_NONE = 0, ///< none - CTL_3D_GLOBAL_OR_PER_APP_TYPES_PER_APP = 1, ///< Opt for per app settings - CTL_3D_GLOBAL_OR_PER_APP_TYPES_GLOBAL = 2, ///< Opt for global settings - CTL_3D_GLOBAL_OR_PER_APP_TYPES_MAX - -} ctl_3d_global_or_per_app_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief 3D feature capability details which will have range/supported and -/// default values -typedef struct _ctl_3d_feature_details_t -{ - ctl_3d_feature_t FeatureType; ///< [out] 3D feature type - ctl_property_value_type_t ValueType; ///< [out] Type of value - ctl_property_info_t Value; ///< [out] Union of various type of values for 3D features. For enum types - ///< this can be anisotropic/frame pacing etc. This member is valid iff - ///< ValueType is not CTL_PROPERTY_VALUE_TYPE_CUSTOM - int32_t CustomValueSize; ///< [in] CustomValue buffer size. Typically for a feature requiring custom - ///< struct, caller will know of it upfront and can provide the right size - ///< info here - void* pCustomValue; ///< [in,out] Pointer to a custom structure. Caller should allocate this - ///< buffer with known custom feature structure size. This member is valid - ///< iff ValueType is CTL_PROPERTY_VALUE_TYPE_CUSTOM - bool PerAppSupport; ///< [out] Flag indicating whether the feature is supported per application - ///< or not - int64_t ConflictingFeatures; ///< [out] Mask of ::ctl_3d_feature_t values which can't be enabled along - ///< with the mentioned FeatureType. If this is 0, it meant the feature - ///< doesn't have any conflicts with other features - int16_t FeatureMiscSupport; ///< [out] 3D Feature Miscellaneous support flags. This will be based on - ///< ::ctl_3d_feature_misc_flags_t - int16_t Reserved; ///< [out] Reserved - int16_t Reserved1; ///< [out] Reserved - int16_t Reserved2; ///< [out] Reserved - -} ctl_3d_feature_details_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief 3D feature which are controllable -typedef struct _ctl_3d_feature_caps_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t NumSupportedFeatures; ///< [in,out] Number of elements in supported features array - ctl_3d_feature_details_t* pFeatureDetails; ///< [in,out] Array of feature details - -} ctl_3d_feature_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief 3D feature for get/set -typedef struct _ctl_3d_feature_getset_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_3d_feature_t FeatureType; ///< [in] Features interested in - char* ApplicationName; ///< [in] Application name for which the property type is applicable. If - ///< this is an empty string then this will get/set global settings for the - ///< given adapter. Note that this should contain only the name of the - ///< application and not the system specific path - int8_t ApplicationNameLength; ///< [in] Length of ApplicationName string - bool bSet; ///< [in] Set this if it's a set call - ctl_property_value_type_t ValueType; ///< [in] Type of value. Caller has to ensure it provides the right value - ///< type which decides how one read the union structure below - ctl_property_t Value; ///< [in,out] Union of various type of values for 3D features. For enum - ///< types this can be anisotropic/frame pacing etc. This member is valid - ///< iff ValueType is not CTL_PROPERTY_VALUE_TYPE_CUSTOM - int32_t CustomValueSize; ///< [in] CustomValue buffer size. Typically for a feature requiring custom - ///< struct, caller will know of it upfront and cn provide the right size - ///< info here - void* pCustomValue; ///< [in,out] Pointer to a custom structure. Caller should allocate this - ///< buffer with known custom feature structure size. This member is valid - ///< iff ValueType is CTL_PROPERTY_VALUE_TYPE_CUSTOM - -} ctl_3d_feature_getset_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Load KMD gaming features. Restricted function -typedef struct _ctl_kmd_load_features_t -{ - ctl_application_id_t ReservedFuncID; ///< [in] Unique ID for reserved/special function - bool bLoad; ///< [in] If set, will load known KMD features. If not set will reset known - ///< KMD features to default - int64_t SubsetFeatureMask; ///< [in,out] Mask indicating the subset of KMD features within - ///< ::ctl_3d_feature_t values. Default of 0 indicate all KMD features - char* ApplicationName; ///< [in] Application name for which the KMD properties are loaded for. If - ///< this is an empty string then this will load global settings for the - ///< given adapter. Note that this should contain only the name of the - ///< application and not the system specific path - int8_t ApplicationNameLength; ///< [in] Length of ApplicationName string - int8_t CallerComponent; ///< [in] Caller component - int64_t Reserved[4]; ///< [in] Reserved field - -} ctl_kmd_load_features_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get 3D capabilities -/// -/// @details -/// - The application gets 3D properties -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pFeatureCaps` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSupported3DCapabilities( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_3d_feature_caps_t* pFeatureCaps ///< [in,out][release] 3D properties - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set 3D feature -/// -/// @details -/// - 3D feature details -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pFeature` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSet3DFeature( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_3d_feature_getset_t* pFeature ///< [in][release] 3D feature get/set parameter - ); - - -#if !defined(__GNUC__) -#pragma endregion // _3D -#endif -// Intel 'ctlApi' for Device Adapter -#if !defined(__GNUC__) -#pragma region display -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a display output instance -typedef struct _ctl_display_output_handle_t *ctl_display_output_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a i2c pin-pair instance -typedef struct _ctl_i2c_pin_pair_handle_t *ctl_i2c_pin_pair_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Check Driver version -/// -/// @details -/// - The application checks driver version -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceAdapter` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlCheckDriverVersion( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter - ctl_version_info_t version_info ///< [in][release] Driver version info - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Enumerate devices -/// -/// @details -/// - The application enumerates all device adapters in the system -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hAPIHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumerateDevices( - ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned - ///< by the CtlInit function - uint32_t* pCount, ///< [in,out][release] pointer to the number of device instances. If count - ///< is zero, then the api will update the value with the total - ///< number of drivers available. If count is non-zero, then the api will - ///< only retrieve the number of drivers. - ///< If count is larger than the number of drivers available, then the api - ///< will update the value with the correct number of drivers available. - ctl_device_adapter_handle_t* phDevices ///< [in,out][optional][release][range(0, *pCount)] array of driver - ///< instance handles - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Enumerate display outputs -/// -/// @details -/// - Enumerates display output capabilities -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceAdapter` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumerateDisplayOutputs( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter - uint32_t* pCount, ///< [in,out][release] pointer to the number of display output instances. - ///< If count is zero, then the api will update the value with the total - ///< number of outputs available. If count is non-zero, then the api will - ///< only retrieve the number of outputs. - ///< If count is larger than the number of drivers available, then the api - ///< will update the value with the correct number of drivers available. - ctl_display_output_handle_t* phDisplayOutputs ///< [in,out][optional][release][range(0, *pCount)] array of display output - ///< instance handles - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Enumerate I2C Pin Pairs -/// -/// @details -/// - Returns available list of I2C Pin-Pairs on a requested adapter -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceAdapter` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "The incoming pointer pCount is null" -/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "The supplied Count is not equal to actual number of i2c pin-pair instances" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumerateI2CPinPairs( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to device adapter - uint32_t* pCount, ///< [in,out][release] pointer to the number of i2c pin-pair instances. If - ///< count is zero, then the api will update the value with the total - ///< number of i2c pin-pair instances available. If count is non-zero and - ///< matches the avaialble number of pin-pairs, then the api will only - ///< return the avaialble number of i2c pin-pair instances in phI2cPinPairs. - ctl_i2c_pin_pair_handle_t* phI2cPinPairs ///< [out][optional][release][range(0, *pCount)] array of i2c pin pair - ///< instance handles. Need to be allocated by Caller when supplying the - ///< *pCount > 0. - ///< If Count is not equal to actual number of i2c pin-pair instances, it - ///< will return CTL_RESULT_ERROR_INVALID_SIZE. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief OS specific Display identifiers -typedef union _ctl_os_display_encoder_identifier_t -{ - uint32_t WindowsDisplayEncoderID; ///< [out] Windows OS Display encoder ID - ctl_generic_void_datatype_t DisplayEncoderID; ///< [out] Display encoder ID for non-windows OS - -} ctl_os_display_encoder_identifier_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Various display types -typedef enum _ctl_display_output_types_t -{ - CTL_DISPLAY_OUTPUT_TYPES_INVALID = 0, ///< Invalid - CTL_DISPLAY_OUTPUT_TYPES_DISPLAYPORT = 1, ///< DisplayPort - CTL_DISPLAY_OUTPUT_TYPES_HDMI = 2, ///< HDMI - CTL_DISPLAY_OUTPUT_TYPES_DVI = 3, ///< DVI - CTL_DISPLAY_OUTPUT_TYPES_MIPI = 4, ///< MIPI - CTL_DISPLAY_OUTPUT_TYPES_CRT = 5, ///< CRT - CTL_DISPLAY_OUTPUT_TYPES_MAX - -} ctl_display_output_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Supported output bits per color (bpc) bitmasks -typedef uint32_t ctl_output_bpc_flags_t; -typedef enum _ctl_output_bpc_flag_t -{ - CTL_OUTPUT_BPC_FLAG_6BPC = CTL_BIT(0), ///< [out] Is 6bpc supported - CTL_OUTPUT_BPC_FLAG_8BPC = CTL_BIT(1), ///< [out] Is 8bpc supported - CTL_OUTPUT_BPC_FLAG_10BPC = CTL_BIT(2), ///< [out] Is 10bpc supported - CTL_OUTPUT_BPC_FLAG_12BPC = CTL_BIT(3), ///< [out] Is 12bpc supported - CTL_OUTPUT_BPC_FLAG_MAX = 0x80000000 - -} ctl_output_bpc_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Display output features. This will indicate only the high level -/// capabilities -typedef uint32_t ctl_std_display_feature_flags_t; -typedef enum _ctl_std_display_feature_flag_t -{ - CTL_STD_DISPLAY_FEATURE_FLAG_HDCP = CTL_BIT(0), ///< [out] Is HDCP supported - CTL_STD_DISPLAY_FEATURE_FLAG_HD_AUDIO = CTL_BIT(1), ///< [out] Is HD Audio supported - CTL_STD_DISPLAY_FEATURE_FLAG_PSR = CTL_BIT(2), ///< [out] Is VESA PSR supported - CTL_STD_DISPLAY_FEATURE_FLAG_ADAPTIVESYNC_VRR = CTL_BIT(3), ///< [out] Is VESA Adaptive Sync or HDMI VRR supported - CTL_STD_DISPLAY_FEATURE_FLAG_VESA_COMPRESSION = CTL_BIT(4), ///< [out] Is display compression (VESA DSC) supported - CTL_STD_DISPLAY_FEATURE_FLAG_HDR = CTL_BIT(5), ///< [out] Is HDR supported - CTL_STD_DISPLAY_FEATURE_FLAG_HDMI_QMS = CTL_BIT(6), ///< [out] Is HDMI QMS supported - CTL_STD_DISPLAY_FEATURE_FLAG_HDR10_PLUS_CERTIFIED = CTL_BIT(7), ///< [out] Is HDR10+ certified - CTL_STD_DISPLAY_FEATURE_FLAG_VESA_HDR_CERTIFIED = CTL_BIT(8), ///< [out] Is VESA HDR certified - for future use - CTL_STD_DISPLAY_FEATURE_FLAG_MAX = 0x80000000 - -} ctl_std_display_feature_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Advanced Graphics Features provided by Intel Graphics Adapter. This -/// will indicate only the high level capabilities -typedef uint32_t ctl_intel_display_feature_flags_t; -typedef enum _ctl_intel_display_feature_flag_t -{ - CTL_INTEL_DISPLAY_FEATURE_FLAG_DPST = CTL_BIT(0), ///< [out] Is DPST supported - CTL_INTEL_DISPLAY_FEATURE_FLAG_LACE = CTL_BIT(1), ///< [out] Is LACE supported - CTL_INTEL_DISPLAY_FEATURE_FLAG_DRRS = CTL_BIT(2), ///< [out] Is DRRS supported - CTL_INTEL_DISPLAY_FEATURE_FLAG_ARC_ADAPTIVE_SYNC_CERTIFIED = CTL_BIT(3),///< [out] Is Intel Arc certified adaptive sync display - CTL_INTEL_DISPLAY_FEATURE_FLAG_MAX = 0x80000000 - -} ctl_intel_display_feature_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Attached Display Mux Type -typedef enum _ctl_attached_display_mux_type_t -{ - CTL_ATTACHED_DISPLAY_MUX_TYPE_NATIVE = 0, ///< [out] Native DP / HDMI - CTL_ATTACHED_DISPLAY_MUX_TYPE_THUNDERBOLT = 1, ///< [out] Thunderbolt - CTL_ATTACHED_DISPLAY_MUX_TYPE_TYPE_C = 2, ///< [out] USB Type C - CTL_ATTACHED_DISPLAY_MUX_TYPE_USB4 = 3, ///< [out] USB4 - CTL_ATTACHED_DISPLAY_MUX_TYPE_MAX - -} ctl_attached_display_mux_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Signal Standard -typedef enum _ctl_signal_standard_type_t -{ - CTL_SIGNAL_STANDARD_TYPE_UNKNOWN = 0, ///< [out] Unknown Signal Standard - CTL_SIGNAL_STANDARD_TYPE_CUSTOM = 1, ///< [out] Custom added timing - CTL_SIGNAL_STANDARD_TYPE_DMT = 2, ///< [out] DMT timing - CTL_SIGNAL_STANDARD_TYPE_GTF = 3, ///< [out] GTF Timing - CTL_SIGNAL_STANDARD_TYPE_CVT = 4, ///< [out] CVT Timing - CTL_SIGNAL_STANDARD_TYPE_CTA = 5, ///< [out] CTA Timing - CTL_SIGNAL_STANDARD_TYPE_MAX - -} ctl_signal_standard_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Protocol Converter Location -typedef uint32_t ctl_protocol_converter_location_flags_t; -typedef enum _ctl_protocol_converter_location_flag_t -{ - CTL_PROTOCOL_CONVERTER_LOCATION_FLAG_ONBOARD = CTL_BIT(0), ///< [out] OnBoard Protocol Converter - CTL_PROTOCOL_CONVERTER_LOCATION_FLAG_EXTERNAL = CTL_BIT(1), ///< [out] External Dongle - CTL_PROTOCOL_CONVERTER_LOCATION_FLAG_MAX = 0x80000000 - -} ctl_protocol_converter_location_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief [out] Display Output configuration related flags which indicate how -/// the output pixel stream drive the panel -typedef uint32_t ctl_display_config_flags_t; -typedef enum _ctl_display_config_flag_t -{ - CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ACTIVE = CTL_BIT(0),///< [out] DisplayActive 0: InActive 1: Active - CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ATTACHED = CTL_BIT(1), ///< [out] DisplayAttached.This Bit indicates if any dongle/display/hub is - ///< attached to the encoder. 0: Not Attached 1: Attached - CTL_DISPLAY_CONFIG_FLAG_IS_DONGLE_CONNECTED_TO_ENCODER = CTL_BIT(2),///< [out] This BIT will be set if a dongle/hub/onboard protocol converter - ///< , is attached to the encoder - CTL_DISPLAY_CONFIG_FLAG_DITHERING_ENABLED = CTL_BIT(3), ///< [out] This BIT will be set if dithering is enabled on the encoder - CTL_DISPLAY_CONFIG_FLAG_MAX = 0x80000000 - -} ctl_display_config_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief [out] Encoder configuration related flags which indicate how the -/// output pixel stream drive the panel -typedef uint32_t ctl_encoder_config_flags_t; -typedef enum _ctl_encoder_config_flag_t -{ - CTL_ENCODER_CONFIG_FLAG_INTERNAL_DISPLAY = CTL_BIT(0), ///< [out] Internal connection or not - CTL_ENCODER_CONFIG_FLAG_VESA_TILED_DISPLAY = CTL_BIT(1),///< [out] VESA DisplayID based tiled display which is driven by either - ///< multiple physical connections (DisplayPort SST) or virtual streams - ///< (DisplayPort MST) - CTL_ENCODER_CONFIG_FLAG_TYPEC_CAPABLE = CTL_BIT(2), ///< [out] This is set if encoder supports type c display - CTL_ENCODER_CONFIG_FLAG_TBT_CAPABLE = CTL_BIT(3), ///< [out] This is set if encoder supports Thunderbolt display - CTL_ENCODER_CONFIG_FLAG_DITHERING_SUPPORTED = CTL_BIT(4), ///< [out] This BIT will be set if encoder supports dithering - CTL_ENCODER_CONFIG_FLAG_VIRTUAL_DISPLAY = CTL_BIT(5), ///< [out] This BIT will be set if this is a virtual display.Hardware based - ///< features will not be applicable to this display.For collage display - ///< this will be set for the virtual output created by driver. For split - ///< display this will be set for the virtual split displays created out of - ///< one single physical display - CTL_ENCODER_CONFIG_FLAG_HIDDEN_DISPLAY = CTL_BIT(6),///< [out] This BIT will be set if display is hidden from OS - CTL_ENCODER_CONFIG_FLAG_COLLAGE_DISPLAY = CTL_BIT(7), ///< [out] This BIT will be set if this is a collage display - CTL_ENCODER_CONFIG_FLAG_SPLIT_DISPLAY = CTL_BIT(8), ///< [out] This BIT will be set if this is a split display - CTL_ENCODER_CONFIG_FLAG_COMPANION_DISPLAY = CTL_BIT(9), ///< [out] This BIT will be set if this is a companion display - CTL_ENCODER_CONFIG_FLAG_MGPU_COLLAGE_DISPLAY = CTL_BIT(10), ///< [out] This BIT will be set if this is a Multi GPU collage display - CTL_ENCODER_CONFIG_FLAG_MAX = 0x80000000 - -} ctl_encoder_config_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Display Timing -typedef struct _ctl_display_timing_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint64_t PixelClock; ///< [out] Pixel Clock in Hz - uint32_t HActive; ///< [out] Horizontal Active - uint32_t VActive; ///< [out] Vertical Active - uint32_t HTotal; ///< [out] Horizontal Total - uint32_t VTotal; ///< [out] Vertical Total - uint32_t HBlank; ///< [out] Horizontal Blank - uint32_t VBlank; ///< [out] Vertical Blank - uint32_t HSync; ///< [out] Horizontal Blank - uint32_t VSync; ///< [out] Vertical Blank - float RefreshRate; ///< [out] Refresh Rate - ctl_signal_standard_type_t SignalStandard; ///< [out] Signal Standard - uint8_t VicId; ///< [out] VIC ID for CTA timings - -} ctl_display_timing_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief This structure will contain the properties of the display currently -/// attached to the encoder. -typedef struct _ctl_display_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_os_display_encoder_identifier_t Os_display_encoder_handle; ///< [out] OS specific Display ID - ctl_display_output_types_t Type; ///< [out] Device Type from display HW stand point. If a DisplayPort - ///< protocol converter is involved, this will indicate it's DisplayPort. - ///< The protocol converter's output will be available from - ///< ProtocolConverterOutput field - ctl_attached_display_mux_type_t AttachedDisplayMuxType; ///< [out] Attached Display Mux Type - ctl_display_output_types_t ProtocolConverterOutput; ///< [out] Protocol output type which can be used if config flags indicate - ///< it's a protocol converter. If it's not a protocol converter this will - ///< be set to CTL_DISPLAY_OUTPUT_TYPES_INVALID - ctl_revision_datatype_t SupportedSpec; ///< [out] Supported industry spec version. - ctl_output_bpc_flags_t SupportedOutputBPCFlags; ///< [out] Supported output bits per color. Refer ::ctl_output_bpc_flag_t. - ///< This is independent of RGB or YCbCr output.This is the max BPC - ///< supported.BPC will vary per mode based on restrictions like bandwidth - ///< and monitor support - ctl_protocol_converter_location_flags_t ProtocolConverterType; ///< [out] Currently Active Protocol Converter. Refer - ///< ::ctl_protocol_converter_location_flag_t - ctl_display_config_flags_t DisplayConfigFlags; ///< [out] Output configuration related flags which indicate how the output - ///< pixel stream drive the panel. Refer ::ctl_display_config_flag_t - ctl_std_display_feature_flags_t FeatureEnabledFlags;///< [out] Enabled Display features.Refer ::ctl_std_display_feature_flag_t. - ctl_std_display_feature_flags_t FeatureSupportedFlags; ///< [out] Display Supported feature.Refer ::ctl_std_display_feature_flag_t - ctl_intel_display_feature_flags_t AdvancedFeatureEnabledFlags; ///< [out] Enabled advanced feature.Refer - ///< ::ctl_intel_display_feature_flag_t. - ctl_intel_display_feature_flags_t AdvancedFeatureSupportedFlags;///< [out] Supported advanced feature.Refer - ///< ::ctl_intel_display_feature_flag_t. - ctl_display_timing_t Display_Timing_Info; ///< [out] Applied Timing on the Display - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_display_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Adapter's display encoder properties -typedef struct _ctl_adapter_display_encoder_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_os_display_encoder_identifier_t Os_display_encoder_handle; ///< [out] OS specific Display ID - ctl_display_output_types_t Type; ///< [out] Device Type from display HW stand point. If a DisplayPort - ///< protocol converter is involved, this will indicate it's DisplayPort. - ///< The protocol converter's output will be available from - ///< ProtocolConverterOutput field - bool IsOnBoardProtocolConverterOutputPresent; ///< [out] Protocol output type which can be used if it's a protocol - ///< converter. If it's not a protocol converter this will be set to - ///< CTL_DISPLAY_OUTPUT_TYPES_INVALID - ctl_revision_datatype_t SupportedSpec; ///< [out] Supported industry spec version - ctl_output_bpc_flags_t SupportedOutputBPCFlags; ///< [out] Supported output bits per color. Refer ::ctl_output_bpc_flag_t. - ///< This is independent of RGB or YCbCr output.This is the max BPC - ///< supported.BPC will vary per mode based on restrictions like bandwidth - ///< and monitor support - ctl_encoder_config_flags_t EncoderConfigFlags; ///< [out] Output configuration related flags which indicate how the output - ///< pixel stream drive the panel. Refer ::ctl_encoder_config_flag_t - ///< Note: - ///< Virtual = 1: This indicates that its a software display. Hardware - ///< based features will not be applicable to this display. - ///< Collage=1,Virtual=1: Indicates the fake display output created by - ///< driver which has the combined resolution of multiple physical displays - ///< involved in collage configuration - ///< Collage=1,Virtual=0: Indicates the child physical displays involved - ///< in a collage configuration. These are real physical outputs - ///< Split=1,Virtual=1 : Indicates the fake display output created by - ///< driver which occupies a portion of a real physical display - ///< Split=1,Virtual=0 : Indicates the physical display which got split - ///< to form multiple split displays - ///< Split=1,Collage=1 : Invalid combination - ///< MgpuCollage=1,Collage=1,Virtual=1: Indicates the fake display - ///< output created by driver which has the combined resolution of multiple - ///< physical displays spread across multiple GPUs involved in Multi-GPU - ///< collage configuration - ///< MgpuCollage=1,Collage=1,Virtual=0: Indicates the child physical - ///< displays involved in a Multi-GPU collage configuration. These are real - ///< physical outputs - ctl_std_display_feature_flags_t FeatureSupportedFlags; ///< [out] Adapter Supported feature flags. Refer - ///< ::ctl_std_display_feature_flag_t - ctl_intel_display_feature_flags_t AdvancedFeatureSupportedFlags;///< [out] Advanced Features Supported by the Adapter. Refer - ///< ::ctl_intel_display_feature_flag_t - uint32_t ReservedFields[16]; ///< [out] Reserved field of 60 bytes - -} ctl_adapter_display_encoder_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Device Properties -/// -/// @details -/// - The application gets device properties -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetDeviceProperties( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to control device adapter - ctl_device_adapter_properties_t* pProperties ///< [in,out][release] Query result for device properties - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Display Properties -/// -/// @details -/// - The application gets display properties -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetDisplayProperties( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_display_properties_t* pProperties ///< [in,out][release] Query result for display properties - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Adapter Display encoder Properties -/// -/// @details -/// - The application gets the graphic adapters display encoder properties -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetAdaperDisplayEncoderProperties( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_adapter_display_encoder_properties_t* pProperties ///< [in,out][release] Query result for adapter display encoder properties - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Level0 Device handle -/// -/// @details -/// - The application gets OneAPI Level0 Device handles -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pZeDevice` -/// + `nullptr == hInstance` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetZeDevice( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - void* pZeDevice, ///< [out][release] ze_device handle - void** hInstance ///< [out][release] Module instance which caller can use to get export - ///< functions directly - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Various sharpness filter types -typedef uint32_t ctl_sharpness_filter_type_flags_t; -typedef enum _ctl_sharpness_filter_type_flag_t -{ - CTL_SHARPNESS_FILTER_TYPE_FLAG_NON_ADAPTIVE = CTL_BIT(0), ///< Non-adaptive sharpness - CTL_SHARPNESS_FILTER_TYPE_FLAG_ADAPTIVE = CTL_BIT(1), ///< Adaptive sharpness - CTL_SHARPNESS_FILTER_TYPE_FLAG_MAX = 0x80000000 - -} ctl_sharpness_filter_type_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Sharpness filter properties -typedef struct _ctl_sharpness_filter_properties_t -{ - ctl_sharpness_filter_type_flags_t FilterType; ///< [out] Filter type. Refer ::ctl_sharpness_filter_type_flag_t - ctl_property_range_info_t FilterDetails; ///< [out] Min, max & step size information - -} ctl_sharpness_filter_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Various sharpness filter types -typedef struct _ctl_sharpness_caps_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_sharpness_filter_type_flags_t SupportedFilterFlags; ///< [out] Supported sharpness filters for a given display output. Refer - ///< ::ctl_sharpness_filter_type_flag_t - uint8_t NumFilterTypes; ///< [out] Number of elements in filter properties array - ctl_sharpness_filter_properties_t* pFilterProperty; ///< [in,out] Array of filter properties structure describing supported - ///< filter capabilities. Caller should provide a pre-allocated memory for - ///< this. - -} ctl_sharpness_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Current sharpness setting -typedef struct _ctl_sharpness_settings_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool Enable; ///< [in,out] Current or new state of sharpness setting - ctl_sharpness_filter_type_flags_t FilterType; ///< [in,out] Current or new filter to be set. Refer - ///< ::ctl_sharpness_filter_type_flag_t - float Intensity; ///< [in,out] Setting intensity to be applied - -} ctl_sharpness_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Sharpness capability -/// -/// @details -/// - Returns sharpness capability -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSharpnessCaps` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSharpnessCaps( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_sharpness_caps_t* pSharpnessCaps ///< [in,out][release] Query result for sharpness capability - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Sharpness setting -/// -/// @details -/// - Returns current sharpness settings -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSharpnessSettings` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetCurrentSharpness( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_sharpness_settings_t* pSharpnessSettings ///< [in,out][release] Query result for sharpness current settings - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set Sharpness setting -/// -/// @details -/// - Set current sharpness settings -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSharpnessSettings` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSetCurrentSharpness( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_sharpness_settings_t* pSharpnessSettings ///< [in][release] Set sharpness current settings - ); - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_I2C_MAX_DATA_SIZE -/// @brief I2C Maximum data size -#define CTL_I2C_MAX_DATA_SIZE 0x0080 -#endif // CTL_I2C_MAX_DATA_SIZE - -/////////////////////////////////////////////////////////////////////////////// -/// @brief I2C Access Args input Flags bitmasks -typedef uint32_t ctl_i2c_flags_t; -typedef enum _ctl_i2c_flag_t -{ - CTL_I2C_FLAG_ATOMICI2C = CTL_BIT(0), ///< Force Atomic I2C. - CTL_I2C_FLAG_1BYTE_INDEX = CTL_BIT(1), ///< 1-byte Indexed operation. If no Index Size flag set, decided based on - ///< Offset Value. - CTL_I2C_FLAG_2BYTE_INDEX = CTL_BIT(2), ///< 2-byte Indexed operation. If no Index Size flag set, decided based on - ///< Offset Value. - CTL_I2C_FLAG_4BYTE_INDEX = CTL_BIT(3), ///< 4-byte Indexed operation. If no Index Size flag set, decided based on - ///< Offset Value. - CTL_I2C_FLAG_SPEED_SLOW = CTL_BIT(4), ///< If no Speed Flag is set, defaults to Best Option possible. - CTL_I2C_FLAG_SPEED_FAST = CTL_BIT(5), ///< If no Speed Flag is set, defaults to Best Option possible. - CTL_I2C_FLAG_SPEED_BIT_BASH = CTL_BIT(6), ///< Uses Slower access using SW bit bashing method. If no Speed Flag is - ///< set, defaults to Best Option possible. - CTL_I2C_FLAG_MAX = 0x80000000 - -} ctl_i2c_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief I2C access arguments -typedef struct _ctl_i2c_access_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t DataSize; ///< [in,out] Valid data size - uint32_t Address; ///< [in] Address to read or write - ctl_operation_type_t OpType; ///< [in] Operation type, 1 for Read, 2 for Write, for Write operation, App - ///< needs to run with admin privileges - uint32_t Offset; ///< [in] Offset - ctl_i2c_flags_t Flags; ///< [in] I2C Flags. Refer ::ctl_i2c_flag_t - uint64_t RAD; ///< [in] RAD, For Future use, to be used for branch devices, Interface - ///< will be provided to get RAD - uint8_t Data[CTL_I2C_MAX_DATA_SIZE]; ///< [in,out] Data array - -} ctl_i2c_access_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief I2C Access -/// -/// @details -/// - Interface to access I2C using display handle as identifier. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pI2cAccessArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid I2C data size" -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlI2CAccess( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_i2c_access_args_t* pI2cAccessArgs ///< [in,out] I2c access arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief I2C Access on PinPair Args input Flags bitmasks -typedef uint32_t ctl_i2c_pinpair_flags_t; -typedef enum _ctl_i2c_pinpair_flag_t -{ - CTL_I2C_PINPAIR_FLAG_ATOMICI2C = CTL_BIT(0), ///< Force Atomic I2C. - CTL_I2C_PINPAIR_FLAG_1BYTE_INDEX = CTL_BIT(1), ///< 1-byte Indexed operation. If no Index Size flag set, decided based on - ///< Offset Value. - CTL_I2C_PINPAIR_FLAG_2BYTE_INDEX = CTL_BIT(2), ///< 2-byte Indexed operation. If no Index Size flag set, decided based on - ///< Offset Value. - CTL_I2C_PINPAIR_FLAG_4BYTE_INDEX = CTL_BIT(3), ///< 4-byte Indexed operation. If no Index Size flag set, decided based on - ///< Offset Value. - CTL_I2C_PINPAIR_FLAG_SPEED_SLOW = CTL_BIT(4), ///< If no Speed Flag is set, defaults to Best Option possible. - CTL_I2C_PINPAIR_FLAG_SPEED_FAST = CTL_BIT(5), ///< If no Speed Flag is set, defaults to Best Option possible. - CTL_I2C_PINPAIR_FLAG_SPEED_BIT_BASH = CTL_BIT(6), ///< Uses Slower access using SW bit bashing method. If no Speed Flag is - ///< set, defaults to Best Option possible. - CTL_I2C_PINPAIR_FLAG_MAX = 0x80000000 - -} ctl_i2c_pinpair_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief I2C access on Pin Pair arguments -typedef struct _ctl_i2c_access_pinpair_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t DataSize; ///< [in,out] Valid data size - uint32_t Address; ///< [in] Address to read or write - ctl_operation_type_t OpType; ///< [in] Operation type, 1 for Read, 2 for Write, for Write operation, App - ///< needs to run with admin privileges - uint32_t Offset; ///< [in] Offset - ctl_i2c_pinpair_flags_t Flags; ///< [in] I2C Flags. Refer ::ctl_i2c_pinpair_flag_t - uint8_t Data[CTL_I2C_MAX_DATA_SIZE]; ///< [in,out] Data array - uint32_t ReservedFields[4]; ///< [in] Reserved for future use, must be set to Zero. - -} ctl_i2c_access_pinpair_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief I2C Access On Pin Pair -/// -/// @details -/// - Interface to access I2C using pin-pair handle as identifier. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hI2cPinPair` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pI2cAccessArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid I2C data size" -/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid Args passed" -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" -/// - ::CTL_RESULT_ERROR_EXTERNAL_DISPLAY_ATTACHED - "Write to Address not allowed when Display is connected" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlI2CAccessOnPinPair( - ctl_i2c_pin_pair_handle_t hI2cPinPair, ///< [in] Handle to I2C pin pair. - ctl_i2c_access_pinpair_args_t* pI2cAccessArgs ///< [in,out] I2c access arguments. - ); - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_AUX_MAX_DATA_SIZE -/// @brief Aux Maximum data size -#define CTL_AUX_MAX_DATA_SIZE 132 -#endif // CTL_AUX_MAX_DATA_SIZE - -/////////////////////////////////////////////////////////////////////////////// -/// @brief AUX Flags bitmasks -typedef uint32_t ctl_aux_flags_t; -typedef enum _ctl_aux_flag_t -{ - CTL_AUX_FLAG_NATIVE_AUX = CTL_BIT(0), ///< For Native AUX operation - CTL_AUX_FLAG_I2C_AUX = CTL_BIT(1), ///< For I2C AUX operation - CTL_AUX_FLAG_I2C_AUX_MOT = CTL_BIT(2), ///< For I2C AUX MOT operation - CTL_AUX_FLAG_MAX = 0x80000000 - -} ctl_aux_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief AUX access arguments -typedef struct _ctl_aux_access_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_operation_type_t OpType; ///< [in] Operation type, 1 for Read, 2 for Write, for Write operation, App - ///< needs to run with admin privileges - ctl_aux_flags_t Flags; ///< [in] Aux Flags. Refer ::ctl_aux_flag_t - uint32_t Address; ///< [in] Address to read or write - uint64_t RAD; ///< [in] RAD, For Future use, to be used for branch devices, Interface - ///< will be provided to get RAD - uint32_t PortID; ///< [in] Port ID, For Future use, to be used for SST tiled devices - uint32_t DataSize; ///< [in,out] Valid data size - uint8_t Data[CTL_AUX_MAX_DATA_SIZE]; ///< [in,out] Data array - -} ctl_aux_access_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Aux Access -/// -/// @details -/// - The application does Aux access, PSR needs to be disabled for AUX -/// call. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pAuxAccessArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid AUX data size" -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_INVALID_AUX_ACCESS_FLAG - "Invalid flag for AUX access" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlAUXAccess( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_aux_access_args_t* pAuxAccessArgs ///< [in,out] Aux access arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Power saving features (Each individual feature's set & get call can be -/// called only once at a time) -typedef uint32_t ctl_power_optimization_flags_t; -typedef enum _ctl_power_optimization_flag_t -{ - CTL_POWER_OPTIMIZATION_FLAG_FBC = CTL_BIT(0), ///< Frame buffer compression - CTL_POWER_OPTIMIZATION_FLAG_PSR = CTL_BIT(1), ///< Panel self refresh - CTL_POWER_OPTIMIZATION_FLAG_DPST = CTL_BIT(2), ///< Display power saving technology (Panel technology dependent) - CTL_POWER_OPTIMIZATION_FLAG_LRR = CTL_BIT(3), ///< Low refresh rate (LRR/ALRR/UBRR), UBRR is supported only for IGCC and - ///< NDA clients. UBZRR and UBLRR both can not be enabled at the same time, - ///< only one can be enabled at a given time - CTL_POWER_OPTIMIZATION_FLAG_LACE = CTL_BIT(4), ///< Lighting Aware Contrast Enhancement - CTL_POWER_OPTIMIZATION_FLAG_MAX = 0x80000000 - -} ctl_power_optimization_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief GPU/Panel/TCON dependent power optimization technology -typedef uint32_t ctl_power_optimization_dpst_flags_t; -typedef enum _ctl_power_optimization_dpst_flag_t -{ - CTL_POWER_OPTIMIZATION_DPST_FLAG_BKLT = CTL_BIT(0), ///< Intel DPST with Backlight control - CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC = CTL_BIT(1), ///< Panel TCON specific Content Adaptive Control mechanism - CTL_POWER_OPTIMIZATION_DPST_FLAG_OPST = CTL_BIT(2), ///< Intel OLED Power Saving Technology - CTL_POWER_OPTIMIZATION_DPST_FLAG_ELP = CTL_BIT(3), ///< TCON based Edge Luminance Profile - CTL_POWER_OPTIMIZATION_DPST_FLAG_EPSM = CTL_BIT(4), ///< Extra power saving mode - CTL_POWER_OPTIMIZATION_DPST_FLAG_APD = CTL_BIT(5), ///< Adaptive Pixel Dimming - CTL_POWER_OPTIMIZATION_DPST_FLAG_PIXOPTIX = CTL_BIT(6), ///< TCON+ based DPST like solution - CTL_POWER_OPTIMIZATION_DPST_FLAG_MAX = 0x80000000 - -} ctl_power_optimization_dpst_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Power Source -typedef enum _ctl_power_source_t -{ - CTL_POWER_SOURCE_AC = 0, ///< Power Source AC - CTL_POWER_SOURCE_DC = 1, ///< Power Source DC - CTL_POWER_SOURCE_MAX - -} ctl_power_source_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Power Optimization Plan -typedef enum _ctl_power_optimization_plan_t -{ - CTL_POWER_OPTIMIZATION_PLAN_BALANCED = 0, ///< Balanced mode - CTL_POWER_OPTIMIZATION_PLAN_HIGH_PERFORMANCE = 1, ///< High Performance Mode - CTL_POWER_OPTIMIZATION_PLAN_POWER_SAVER = 2, ///< Power Saver Mode - CTL_POWER_OPTIMIZATION_PLAN_MAX - -} ctl_power_optimization_plan_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Type of low refresh rate feature -typedef uint32_t ctl_power_optimization_lrr_flags_t; -typedef enum _ctl_power_optimization_lrr_flag_t -{ - CTL_POWER_OPTIMIZATION_LRR_FLAG_LRR10 = CTL_BIT(0), ///< LRR 1.0 - CTL_POWER_OPTIMIZATION_LRR_FLAG_LRR20 = CTL_BIT(1), ///< LRR 2.0 - CTL_POWER_OPTIMIZATION_LRR_FLAG_LRR25 = CTL_BIT(2), ///< LRR 2.5 - CTL_POWER_OPTIMIZATION_LRR_FLAG_ALRR = CTL_BIT(3), ///< Autonomous LRR - CTL_POWER_OPTIMIZATION_LRR_FLAG_UBLRR = CTL_BIT(4), ///< User based low refresh rate - CTL_POWER_OPTIMIZATION_LRR_FLAG_UBZRR = CTL_BIT(5), ///< User based zero refresh rate - CTL_POWER_OPTIMIZATION_LRR_FLAG_MAX = 0x80000000 - -} ctl_power_optimization_lrr_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Power optimization caps -typedef struct _ctl_power_optimization_caps_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_power_optimization_flags_t SupportedFeatures; ///< [out] Supported power optimization features. Refer - ///< ::ctl_power_optimization_flag_t - -} ctl_power_optimization_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Power optimization features -/// -/// @details -/// - Returns power optimization capabilities -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pPowerOptimizationCaps` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetPowerOptimizationCaps( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_power_optimization_caps_t* pPowerOptimizationCaps ///< [in,out][release] Query result for power optimization features - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief LRR detailed settings -typedef struct _ctl_power_optimization_lrr_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_power_optimization_lrr_flags_t SupportedLRRTypes; ///< [out] LRR type(s). Refer ::ctl_power_optimization_lrr_flag_t - ctl_power_optimization_lrr_flags_t CurrentLRRTypes; ///< [in,out] Current enabled LRR type(s) or the LRR type(s) to set to. - ///< Refer ::ctl_power_optimization_lrr_flag_t - bool bRequirePSRDisable; ///< [out] Require PSR disable for any change in the selected LRR feature. - ///< Caller can re-enable PSR once the respective LRR feature is - ///< enable/disabled. E.g. for UBRR based on platform this flag may not be - ///< set in which case caller doesn't need to do an explicit PSR disable - uint16_t LowRR; ///< [out] Lowest RR used for LRR functionality if known to source - -} ctl_power_optimization_lrr_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PSR detailed settings -typedef struct _ctl_power_optimization_psr_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint8_t PSRVersion; ///< [in,out] A value of 1 means PSR1, 2 means PSR2 - bool FullFetchUpdate; ///< [in,out] Full fetch and update - -} ctl_power_optimization_psr_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief DPST detailed settings -typedef struct _ctl_power_optimization_dpst_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint8_t MinLevel; ///< [out] Minimum supported aggressiveness level - uint8_t MaxLevel; ///< [out] Maximum supported aggressiveness level - uint8_t Level; ///< [in,out] Current aggressiveness level to be set - ctl_power_optimization_dpst_flags_t SupportedFeatures; ///< [out] Supported features - ctl_power_optimization_dpst_flags_t EnabledFeatures;///< [in,out] Features enabled or to be enabled. Fill only one feature for - ///< SET call - -} ctl_power_optimization_dpst_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Feature specific power optimization data -typedef union _ctl_power_optimization_feature_specific_info_t -{ - ctl_power_optimization_lrr_t LRRInfo; ///< [out] LRR info - ctl_power_optimization_psr_t PSRInfo; ///< [in,out] PSR info - ctl_power_optimization_dpst_t DPSTInfo; ///< [in,out] DPST info - -} ctl_power_optimization_feature_specific_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Power optimization settings -typedef struct _ctl_power_optimization_settings_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_power_optimization_plan_t PowerOptimizationPlan;///< [in] Power optimization power plan (max power/max perf/balanced) - ctl_power_optimization_flags_t PowerOptimizationFeature;///< [in] Power optimization feature interested in. Refer - ///< ::ctl_power_optimization_flag_t - bool Enable; ///< [in,out] Enable state - ctl_power_optimization_feature_specific_info_t FeatureSpecificData; ///< [in,out] Data specific to the feature caller is interested in - ctl_power_source_t PowerSource; ///< [in] AC/DC - -} ctl_power_optimization_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Brightness settings for SET call -typedef struct _ctl_set_brightness_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t TargetBrightness; ///< [in] The brightness level that the display need to transitioning to in - ///< milli-percentage. Range is 0-100000 (100%) - uint32_t SmoothTransitionTimeInMs; ///< [in] Transition Time for brightness to take effect in milli-seconds. - ///< If its 0 then it will be an immediate change. Maximum possible value - ///< is 1000ms. - uint32_t ReservedFields[4]; ///< [in] Reserved for future use - -} ctl_set_brightness_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Brightness settings for GET call -typedef struct _ctl_get_brightness_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t TargetBrightness; ///< [out] The brightness level that the display is currently transitioning - ///< to in milli-percentage. If not in a transition, this should equal the - ///< current brightness. Range is 0-100000 (100%) - uint32_t CurrentBrightness; ///< [out] The current brightness level of the display in milli-percentage - uint32_t ReservedFields[4]; ///< [out] Reserved for future use - -} ctl_get_brightness_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Power optimization setting -/// -/// @details -/// - Returns power optimization setting for a specific feature -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pPowerOptimizationSettings` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG - "Unsupported PowerOptimizationFeature" -/// - ::CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST - "DPST is supported only in DC Mode" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetPowerOptimizationSetting( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_power_optimization_settings_t* pPowerOptimizationSettings ///< [in,out][release] Power optimization data to be fetched - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set Power optimization setting -/// -/// @details -/// - Set power optimization setting for a specific feature -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pPowerOptimizationSettings` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG - "Unsupported PowerOptimizationFeature" -/// - ::CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST - "DPST is supported only in DC Mode" -/// - ::CTL_RESULT_ERROR_SET_FBC_FEATURE_NOT_SUPPORTED - "Set FBC Feature not supported" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSetPowerOptimizationSetting( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_power_optimization_settings_t* pPowerOptimizationSettings ///< [in][release] Power optimization data to be applied - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set Brightness on companion display -/// -/// @details -/// - Set Brightness for a target display. Currently support is only for -/// companion display. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSetBrightnessSetting` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid Brightness data passed as argument" -/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Currently Brightness API is supported only on companion display" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSetBrightnessSetting( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_set_brightness_t* pSetBrightnessSetting ///< [in][release] Brightness settings to be applied - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Brightness setting -/// -/// @details -/// - Get Brightness for a target display. Currently support is only for -/// companion display. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pGetBrightnessSetting` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Currently Brightness API is supported only on companion display" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetBrightnessSetting( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_get_brightness_t* pGetBrightnessSetting ///< [out][release] Brightness settings data to be fetched - ); - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_MAX_NUM_SAMPLES_PER_CHANNEL_1D_LUT -/// @brief Maximum number of samples per channel 1D LUT -#define CTL_MAX_NUM_SAMPLES_PER_CHANNEL_1D_LUT 8192 -#endif // CTL_MAX_NUM_SAMPLES_PER_CHANNEL_1D_LUT - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixtx pipe set configuration flags bitmasks -typedef uint32_t ctl_pixtx_pipe_set_config_flags_t; -typedef enum _ctl_pixtx_pipe_set_config_flag_t -{ - CTL_PIXTX_PIPE_SET_CONFIG_FLAG_PERSIST_ACROSS_POWER_EVENTS = CTL_BIT(0),///< For maintaining persistance across power events - CTL_PIXTX_PIPE_SET_CONFIG_FLAG_MAX = 0x80000000 - -} ctl_pixtx_pipe_set_config_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation block types -typedef enum _ctl_pixtx_block_type_t -{ - CTL_PIXTX_BLOCK_TYPE_1D_LUT = 1, ///< Block type 1D LUT - CTL_PIXTX_BLOCK_TYPE_3D_LUT = 2, ///< Block type 3D LUT - CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX = 3, ///< Block type 3x3 matrix - CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX_AND_OFFSETS = 4,///< Block type 3x3 matrix and offsets - CTL_PIXTX_BLOCK_TYPE_MAX - -} ctl_pixtx_block_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation LUT sampling types -typedef enum _ctl_pixtx_lut_sampling_type_t -{ - CTL_PIXTX_LUT_SAMPLING_TYPE_UNIFORM = 0, ///< Uniform LUT sampling - CTL_PIXTX_LUT_SAMPLING_TYPE_NONUNIFORM = 1, ///< Non uniform LUT sampling, Required mainly in HDR mode - CTL_PIXTX_LUT_SAMPLING_TYPE_MAX - -} ctl_pixtx_lut_sampling_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configuration query types -typedef enum _ctl_pixtx_config_query_type_t -{ - CTL_PIXTX_CONFIG_QUERY_TYPE_CAPABILITY = 0, ///< Get complete pixel processing pipeline capability - CTL_PIXTX_CONFIG_QUERY_TYPE_CURRENT = 1, ///< Get the configuration set through last set call - CTL_PIXTX_CONFIG_QUERY_TYPE_MAX - -} ctl_pixtx_config_query_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configuration operation types -typedef enum _ctl_pixtx_config_opertaion_type_t -{ - CTL_PIXTX_CONFIG_OPERTAION_TYPE_RESTORE_DEFAULT = 1,///< Restore block by block or entire pipe line. Use NumBlocks = 0 to - ///< restore all. - CTL_PIXTX_CONFIG_OPERTAION_TYPE_SET_CUSTOM = 2, ///< Custom LUT or matrix can be set thorugh this option. - CTL_PIXTX_CONFIG_OPERTAION_TYPE_MAX - -} ctl_pixtx_config_opertaion_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation gamma encoding types -typedef enum _ctl_pixtx_gamma_encoding_type_t -{ - CTL_PIXTX_GAMMA_ENCODING_TYPE_SRGB = 0, ///< Gamma encoding SRGB - CTL_PIXTX_GAMMA_ENCODING_TYPE_REC709 = 1, ///< Gamma encoding REC709, Applicable for REC2020 as well - CTL_PIXTX_GAMMA_ENCODING_TYPE_ST2084 = 2, ///< Gamma encoding ST2084 - CTL_PIXTX_GAMMA_ENCODING_TYPE_HLG = 3, ///< Gamma encoding HLG - CTL_PIXTX_GAMMA_ENCODING_TYPE_LINEAR = 4, ///< Gamma encoding linear - CTL_PIXTX_GAMMA_ENCODING_TYPE_MAX - -} ctl_pixtx_gamma_encoding_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation color space types -typedef enum _ctl_pixtx_color_space_t -{ - CTL_PIXTX_COLOR_SPACE_REC709 = 0, ///< Color space REC709 - CTL_PIXTX_COLOR_SPACE_REC2020 = 1, ///< Color space REC2020 - CTL_PIXTX_COLOR_SPACE_ADOBE_RGB = 2, ///< Color space AdobeRGB - CTL_PIXTX_COLOR_SPACE_P3_D65 = 3, ///< Color space P3_D65 - CTL_PIXTX_COLOR_SPACE_P3_DCI = 4, ///< Color space P3_DCI - CTL_PIXTX_COLOR_SPACE_P3_D60 = 5, ///< Color space P3_D60 - CTL_PIXTX_COLOR_SPACE_CUSTOM = 0xFFFF, ///< Color space custom, Refer ::ctl_pixtx_color_primaries_t for color - ///< primary details - CTL_PIXTX_COLOR_SPACE_MAX - -} ctl_pixtx_color_space_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation color model types -typedef enum _ctl_pixtx_color_model_t -{ - CTL_PIXTX_COLOR_MODEL_RGB_FR = 0, ///< Color model RGB full range - CTL_PIXTX_COLOR_MODEL_RGB_LR = 1, ///< Color model RGB limited range - CTL_PIXTX_COLOR_MODEL_YCBCR_422_FR = 2, ///< Color model YCBCR 422 full range - CTL_PIXTX_COLOR_MODEL_YCBCR_422_LR = 3, ///< Color model YCBCR 422 limited range - CTL_PIXTX_COLOR_MODEL_YCBCR_420_FR = 4, ///< Color model YCBCR 420 full range - CTL_PIXTX_COLOR_MODEL_YCBCR_420_LR = 5, ///< Color model YCBCR 420 limited range - CTL_PIXTX_COLOR_MODEL_YCBCR_444_FR = 6, ///< Color model YCBCR 444 full range - CTL_PIXTX_COLOR_MODEL_YCBCR_444_LR = 7, ///< Color model YCBCR 444 limited range - CTL_PIXTX_COLOR_MODEL_MAX - -} ctl_pixtx_color_model_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation color primaries -typedef struct _ctl_pixtx_color_primaries_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - double xR; ///< [out] CIE1931 x value with maximum red pixel value - double yR; ///< [out] CIE1931 y value with maximum red pixel value - double xG; ///< [out] CIE1931 x value with maximum green pixel value - double yG; ///< [out] CIE1931 y value with maximum green pixel value - double xB; ///< [out] CIE1931 x value with maximum blue pixel value - double yB; ///< [out] CIE1931 y value with maximum blue pixel value - double xW; ///< [out] CIE1931 x value with maximum white pixel value - double yW; ///< [out] CIE1931 y value with maximum white pixel value - -} ctl_pixtx_color_primaries_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation pixel format -typedef struct _ctl_pixtx_pixel_format_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t BitsPerColor; ///< [out] Bits per color, It Will be 16 for FP16 case - bool IsFloat; ///< [out] Will be set for FP16 or other floating point encoding schemes - ctl_pixtx_gamma_encoding_type_t EncodingType; ///< [out] Encoding type - ctl_pixtx_color_space_t ColorSpace; ///< [out] Color space - ctl_pixtx_color_model_t ColorModel; ///< [out] Color model - ctl_pixtx_color_primaries_t ColorPrimaries; ///< [out] Color primaries, Used mainly for custom color space - double MaxBrightness; ///< [out] Maximum brightness of pixel values. If no input is given, - ///< default will be set to sRGB during set call. If panel capability is - ///< not known get call will default to sRGB. - double MinBrightness; ///< [out] Minimum brightness of pixel values - -} ctl_pixtx_pixel_format_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation 1D LUT configuration -typedef struct _ctl_pixtx_1dlut_config_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_pixtx_lut_sampling_type_t SamplingType; ///< [in,out] Blocks with non-uniform sampling capability support unifrom - ///< sampling also but not vice versa. - uint32_t NumSamplesPerChannel; ///< [in,out] Number of samples per channel. Resampled internally based on - ///< HW capability for uniformly sampled LUT.Maximum supported value is - ///< ::CTL_MAX_NUM_SAMPLES_PER_CHANNEL_1D_LUT Caller needs to use exact - ///< sampling position given in pSamplePositions for non-uniformly sampled - ///< LUTs. - uint32_t NumChannels; ///< [in,out] Number of channels, 1 for Grey scale LUT, 3 for RGB LUT - double* pSampleValues; ///< [in,out] Pointer to sample values, R array followed by G and B arrays - ///< in case of multi-channel LUT. Allocation size for pSampleValues should - ///< be NumSamplesPerChannel * NumChannels * sizeof(double) - double* pSamplePositions; ///< [out] LUT (same for all channels) to represent sampling positions for - ///< non-uniformly sampled LUTs.Can be NULL in case uniformly sampled LUTs - -} ctl_pixtx_1dlut_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation matrix configuration -typedef struct _ctl_pixtx_matrix_config_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - double PreOffsets[3]; ///< [in,out] Pre offsets - double PostOffsets[3]; ///< [in,out] Post offsets - double Matrix[3][3]; ///< [in,out] 3x3 Matrix - -} ctl_pixtx_matrix_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation 3D LUT sample. Samples are converted to integer -/// based on underlying HW capabilities. Hence slight precision loss will -/// be observed while getting sample values. -typedef struct _ctl_pixtx_3dlut_sample_t -{ - double Red; ///< [in,out] Red output value - double Green; ///< [in,out] Green output value - double Blue; ///< [in,out] Blue output value - -} ctl_pixtx_3dlut_sample_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation 3D LUT configuration -typedef struct _ctl_pixtx_3dlut_config_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t NumSamplesPerChannel; ///< [in,out] Number of samples per channel - ctl_pixtx_3dlut_sample_t* pSampleValues; ///< [in,out] Pointer to sample values, R in outer most loop followed by G - ///< and B - -} ctl_pixtx_3dlut_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation configuration -typedef union _ctl_pixtx_config_t -{ - ctl_pixtx_1dlut_config_t OneDLutConfig; ///< [in,out] 1D LUT configuration - ctl_pixtx_3dlut_config_t ThreeDLutConfig; ///< [in,out] 3D LUT configuration - ctl_pixtx_matrix_config_t MatrixConfig; ///< [in,out] Matrix configuration - -} ctl_pixtx_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation block configuration -typedef struct _ctl_pixtx_block_config_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t BlockId; ///< [in,out] Unique ID for each pixel processing block. Id for a block is - ///< fixed for a platform. - ctl_pixtx_block_type_t BlockType; ///< [in,out] Block type - ctl_pixtx_config_t Config; ///< [in,out] Configuration - -} ctl_pixtx_block_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation pipe get configuration -typedef struct _ctl_pixtx_pipe_get_config_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_pixtx_config_query_type_t QueryType; ///< [in] Query operation type - ctl_pixtx_pixel_format_t InputPixelFormat; ///< [out] Input pixel format - ctl_pixtx_pixel_format_t OutputPixelFormat; ///< [out] Output pixel format - uint32_t NumBlocks; ///< [out] Number of blocks - ctl_pixtx_block_config_t* pBlockConfigs; ///< [out] Pointer to specific configs - -} ctl_pixtx_pipe_get_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation pipe set configuration -typedef struct _ctl_pixtx_pipe_set_config_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_pixtx_config_opertaion_type_t OpertaionType;///< [in] Set operation type - ctl_pixtx_pipe_set_config_flags_t Flags; ///< [in] Config flags. Refer ::ctl_pixtx_pipe_set_config_flag_t - uint32_t NumBlocks; ///< [in] Number of blocks - ctl_pixtx_block_config_t* pBlockConfigs; ///< [in,out] Array of block specific configs - -} ctl_pixtx_pipe_set_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation get pipe configuration -/// -/// @details -/// - The application does pixel transformation get pipe configuration -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pPixTxGetConfigArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -/// - ::CTL_RESULT_ERROR_INVALID_PIXTX_GET_CONFIG_QUERY_TYPE - "Invalid query type" -/// - ::CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID - "Invalid block id" -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PIXTX_BLOCK_CONFIG_MEMORY - "Insufficient memery allocated for BlockConfigs" -/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_PIPE - "Invalid pipe for 3dlut" -/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_DATA - "Invalid 3dlut data" -/// - ::CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR - "3dlut not supported in HDR" -/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION - "Invalid 3dlut operation" -/// - ::CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL - "3dlut call unsuccessful" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPixelTransformationGetConfig( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_pixtx_pipe_get_config_t* pPixTxGetConfigArgs///< [in,out] Pixel transformation get pipe configiguration arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Pixel transformation set pipe configuration -/// -/// @details -/// - The application does pixel transformation set pipe configuration -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pPixTxSetConfigArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -/// - ::CTL_RESULT_ERROR_INVALID_PIXTX_SET_CONFIG_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INVALID_SET_CONFIG_NUMBER_OF_SAMPLES - "Invalid number of samples" -/// - ::CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID - "Invalid block id" -/// - ::CTL_RESULT_ERROR_PERSISTANCE_NOT_SUPPORTED - "Persistance not supported" -/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_PIPE - "Invalid pipe for 3dlut" -/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_DATA - "Invalid 3dlut data" -/// - ::CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR - "3dlut not supported in HDR" -/// - ::CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION - "Invalid 3dlut operation" -/// - ::CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL - "3dlut call unsuccessful" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPixelTransformationSetConfig( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_pixtx_pipe_set_config_t* pPixTxSetConfigArgs///< [in,out] Pixel transformation set pipe configiguration arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Panel descriptor access arguments -typedef struct _ctl_panel_descriptor_access_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_operation_type_t OpType; ///< [in] Operation type, 1 for Read, 2 for Write. App needs to run with - ///< admin privileges for Write operation, Currently only Read operation is - ///< supported - uint32_t BlockNumber; ///< [in] Block number, Need to provide only if acccessing EDID - uint32_t DescriptorDataSize; ///< [in] Descriptor data size, Should be 0 for querying the size and - ///< should be DescriptorDataSize derived from query call otherwise - uint8_t* pDescriptorData; ///< [in,out] Panel descriptor data - -} ctl_panel_descriptor_access_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Panel Descriptor Access -/// -/// @details -/// - The application does EDID or Display ID access -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pPanelDescriptorAccessArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPanelDescriptorAccess( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_panel_descriptor_access_args_t* pPanelDescriptorAccessArgs ///< [in,out] Panel descriptor access arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retro Scaling Types -typedef uint32_t ctl_retro_scaling_type_flags_t; -typedef enum _ctl_retro_scaling_type_flag_t -{ - CTL_RETRO_SCALING_TYPE_FLAG_INTEGER = CTL_BIT(0), ///< Integer Scaling - CTL_RETRO_SCALING_TYPE_FLAG_NEAREST_NEIGHBOUR = CTL_BIT(1), ///< Nearest Neighbour Scaling - CTL_RETRO_SCALING_TYPE_FLAG_MAX = 0x80000000 - -} ctl_retro_scaling_type_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set/Get Retro Scaling Type -typedef struct _ctl_retro_scaling_settings_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool Get; ///< [in][release] Set to true to get current scaling . Set to False to Set - ///< the scaling - bool Enable; ///< [in,out] State of the scaler - ctl_retro_scaling_type_flags_t RetroScalingType;///< [out] Requested retro scaling types. Refer - ///< ::ctl_retro_scaling_type_flag_t - -} ctl_retro_scaling_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Retro Scaling caps -typedef struct _ctl_retro_scaling_caps_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_retro_scaling_type_flags_t SupportedRetroScaling; ///< [out] Supported retro scaling types - -} ctl_retro_scaling_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Supported Retro Scaling Types -/// -/// @details -/// - Returns supported retro scaling capabilities -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pRetroScalingCaps` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSupportedRetroScalingCapability( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter - ctl_retro_scaling_caps_t* pRetroScalingCaps ///< [in,out][release] Query result for supported retro scaling types - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Retro Scaling -/// -/// @details -/// - Get or Set the status of retro scaling.This Api will do a physical -/// modeset resulting in flash on the screen -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pGetSetRetroScalingType` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSetRetroScaling( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter - ctl_retro_scaling_settings_t* pGetSetRetroScalingType ///< [in,out][release] Get or Set the retro scaling type - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Scaling Types -typedef uint32_t ctl_scaling_type_flags_t; -typedef enum _ctl_scaling_type_flag_t -{ - CTL_SCALING_TYPE_FLAG_IDENTITY = CTL_BIT(0), ///< No scaling is applied and display manages scaling itself when possible - CTL_SCALING_TYPE_FLAG_CENTERED = CTL_BIT(1), ///< Source is not scaled but place in the center of the target display - CTL_SCALING_TYPE_FLAG_STRETCHED = CTL_BIT(2), ///< Source is stretched to fit the target size - CTL_SCALING_TYPE_FLAG_ASPECT_RATIO_CENTERED_MAX = CTL_BIT(3), ///< The aspect ratio is maintained with the source centered - CTL_SCALING_TYPE_FLAG_CUSTOM = CTL_BIT(4), ///< None of the standard types match this .Additional parameters are - ///< required which should be set via a private driver interface - CTL_SCALING_TYPE_FLAG_MAX = 0x80000000 - -} ctl_scaling_type_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Scaling caps -typedef struct _ctl_scaling_caps_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_scaling_type_flags_t SupportedScaling; ///< [out] Supported scaling types. Refer ::ctl_scaling_type_flag_t - -} ctl_scaling_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set/Get Scaling type -typedef struct _ctl_scaling_settings_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool Enable; ///< [in,out] State of the scaler - ctl_scaling_type_flags_t ScalingType; ///< [in,out] Requested scaling types. Refer ::ctl_scaling_type_flag_t - uint32_t CustomScalingX; ///< [in,out] Custom Scaling X resolution - uint32_t CustomScalingY; ///< [in,out] Custom Scaling Y resolution - bool HardwareModeSet; ///< [in] Flag to indicate hardware modeset should be done to apply the - ///< scaling.Setting this to true would result in a flash on the screen. If - ///< this flag is set to false , API will request the OS to do a virtual - ///< modeset , but the OS can ignore this request and do a hardware modeset - ///< in some instances - -} ctl_scaling_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Supported Scaling Types -/// -/// @details -/// - Returns supported scaling capabilities -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pScalingCaps` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSupportedScalingCapability( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_scaling_caps_t* pScalingCaps ///< [in,out][release] Query result for supported scaling types - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Current Scaling -/// -/// @details -/// - Returns current active scaling -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pGetCurrentScalingType` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetCurrentScaling( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_scaling_settings_t* pGetCurrentScalingType ///< [in,out][release] Query result for active scaling types - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set Scaling Type -/// -/// @details -/// - Returns current active scaling -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSetScalingType` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSetCurrentScaling( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_scaling_settings_t* pSetScalingType ///< [in,out][release] Set scaling types - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Ambient light based enhancement table entry -typedef struct _ctl_lace_lux_aggr_map_entry_t -{ - uint32_t Lux; ///< [in,out] Ambient lux - uint8_t AggressivenessPercent; ///< [in,out] Pixel boost agressiveness - -} ctl_lace_lux_aggr_map_entry_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Ambient light based enhancement table -typedef struct _ctl_lace_lux_aggr_map_t -{ - uint32_t MaxNumEntries; ///< [out] Max Number of entries in mapping table supported - uint32_t NumEntries; ///< [in,out] Number of entries in the given mapping table - ctl_lace_lux_aggr_map_entry_t* pLuxToAggrMappingTable; ///< [in] Max number of Entries which can be passed in - ///< LuxToAggrMappingTable - -} ctl_lace_lux_aggr_map_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Data specific to the mode caller is interested in -typedef union _ctl_lace_aggr_config_t -{ - uint8_t FixedAggressivenessLevelPercent; ///< [in,out] Fixed aggressiveness level, applicable for - ///< CTL_LACE_MODE_FIXED_AGGR_LEVEL - ctl_lace_lux_aggr_map_t AggrLevelMap; ///< [in,out] Lux to enhancement mapping table, applicable for - ///< CTL_LACE_MODE_AMBIENT_ADAPTIVE - -} ctl_lace_aggr_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Operations used for additional settings -typedef uint32_t ctl_get_operation_flags_t; -typedef enum _ctl_get_operation_flag_t -{ - CTL_GET_OPERATION_FLAG_CURRENT = CTL_BIT(0), ///< Get the details set through last set call - CTL_GET_OPERATION_FLAG_DEFAULT = CTL_BIT(1), ///< Get the driver default values - CTL_GET_OPERATION_FLAG_CAPABILITY = CTL_BIT(2), ///< Get capability - CTL_GET_OPERATION_FLAG_MAX = 0x80000000 - -} ctl_get_operation_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set Operations used for additional settings -typedef enum _ctl_set_operation_t -{ - CTL_SET_OPERATION_RESTORE_DEFAULT = 0, ///< Restore default values - CTL_SET_OPERATION_CUSTOM = 1, ///< Set custom values - CTL_SET_OPERATION_MAX - -} ctl_set_operation_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Lace Trigger Modes -typedef uint32_t ctl_lace_trigger_flags_t; -typedef enum _ctl_lace_trigger_flag_t -{ - CTL_LACE_TRIGGER_FLAG_AMBIENT_LIGHT = CTL_BIT(0), ///< LACE enhancement depends on Ambient light - CTL_LACE_TRIGGER_FLAG_FIXED_AGGRESSIVENESS = CTL_BIT(1),///< LACE enhancement is as per given fixed aggressiveness level - CTL_LACE_TRIGGER_FLAG_MAX = 0x80000000 - -} ctl_lace_trigger_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set/Get LACE Config -typedef struct _ctl_lace_config_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool Enabled; ///< [in,out] Enable or disable LACE feature - ctl_get_operation_flags_t OpTypeGet; ///< [in] Get Operations used for additional settings - ctl_set_operation_t OpTypeSet; ///< [in] Set Operations used for additional settings - ctl_lace_trigger_flags_t Trigger; ///< [in,out] LACE operating mode to be Triggerd - ctl_lace_aggr_config_t LaceConfig; ///< [in,out] Data specific to the mode, caller is interested in - -} ctl_lace_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get LACE Config -/// -/// @details -/// - Returns current LACE Config -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pLaceConfig` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED - "Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data passed by user" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetLACEConfig( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_lace_config_t* pLaceConfig ///< [out]Lace configuration - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Sets LACE Config -/// -/// @details -/// - Sets LACE Config -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pLaceConfig` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED - "Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data passed by user" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSetLACEConfig( - ctl_display_output_handle_t hDisplayOutput, ///< [in]Handle to display output - ctl_lace_config_t* pLaceConfig ///< [in]Lace configuration - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Software PSR status/Set Software PSR settings -typedef struct _ctl_sw_psr_settings_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool Set; ///< [in][release] Set to False to Get Software PSR status. Set to True to - ///< Enable/Disable Software PSR - bool Supported; ///< [out] When Get is True, returns if SW PSR is supported - bool Enable; ///< [in,out] When Get is True, returns current state of Software PSR. - ///< When Get is False, Enables/Diasbles Software PSR - -} ctl_sw_psr_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Software PSR caps/Set software PSR State -/// -/// @details -/// - Returns Software PSR status or Sets Software PSR capabilities. This is -/// a reserved capability. By default, software PSR is not supported/will -/// not be enabled, need application to activate it, please contact Intel -/// for activation. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSoftwarePsrSetting` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSoftwarePSR( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_sw_psr_settings_t* pSoftwarePsrSetting ///< [in,out][release] Get Software PSR caps/state or Set Software PSR - ///< state - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intel Arc Sync Monitor Params -typedef struct _ctl_intel_arc_sync_monitor_params_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool IsIntelArcSyncSupported; ///< [out] Intel Arc Sync support for the monitor - float MinimumRefreshRateInHz; ///< [out] Minimum Intel Arc Sync refresh rate supported by the monitor - float MaximumRefreshRateInHz; ///< [out] Maximum Intel Arc Sync refresh rate supported by the monitor - uint32_t MaxFrameTimeIncreaseInUs; ///< [out] Max frame time increase in micro seconds from DID2.1 Adaptive - ///< Sync block - uint32_t MaxFrameTimeDecreaseInUs; ///< [out] Max frame time decrease in micro seconds from DID2.1 Adaptive - ///< Sync block - -} ctl_intel_arc_sync_monitor_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Intel Arc Sync information for monitor -/// -/// @details -/// - Returns Intel Arc Sync information for selected monitor -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pIntelArcSyncMonitorParams` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetIntelArcSyncInfoForMonitor( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_intel_arc_sync_monitor_params_t* pIntelArcSyncMonitorParams ///< [in,out][release] Intel Arc Sync params for monitor - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a MUX output instance -typedef struct _ctl_mux_output_handle_t *ctl_mux_output_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Enumerate Display MUX Devices on this system across adapters -/// -/// @details -/// - The application enumerates all MUX devices in the system -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hAPIHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -/// + `nullptr == phMuxDevices` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumerateMuxDevices( - ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned - ///< by the CtlInit function - uint32_t* pCount, ///< [in,out][release] pointer to the number of MUX device instances. If - ///< input count is zero, then the api will update the value with the total - ///< number of MUX devices available and return the Count value. If input - ///< count is non-zero, then the api will only retrieve the number of MUX Devices. - ///< If count is larger than the number of MUX devices available, then the - ///< api will update the value with the correct number of MUX devices available. - ctl_mux_output_handle_t* phMuxDevices ///< [out][range(0, *pCount)] array of MUX device instance handles - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Display MUX device properties -typedef struct _ctl_mux_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint8_t MuxId; ///< [out] MUX ID of this MUX device enumerated - uint32_t Count; ///< [in,out] Pointer to the number of display output instances this MUX - ///< object can drive. If count is zero, then the api will update the value - ///< with the total - ///< number of outputs available. If count is non-zero, then the api will - ///< only retrieve the number of outputs. - ///< If count is larger than the number of display outputs MUX can drive, - ///< then the api will update the value with the correct number of display - ///< outputs MUX can driver. - ctl_display_output_handle_t* phDisplayOutputs; ///< [in,out][range(0, *pCount)] Array of display output instance handles - ///< this MUX device can drive - uint8_t IndexOfDisplayOutputOwningMux; ///< [out] [range(0, (Count-1))] This is the index into the - ///< phDisplayOutputs list to the display output which currently owns the - ///< MUX output. This doesn't mean display is active - -} ctl_mux_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Display Mux properties -/// -/// @details -/// - Get the propeties of the Mux device -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMuxDevice` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pMuxProperties` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetMuxProperties( - ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle - ctl_mux_properties_t* pMuxProperties ///< [in,out] MUX device properties - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Switch Mux output -/// -/// @details -/// - Switches the MUX output -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMuxDevice` -/// + `nullptr == hInactiveDisplayOutput` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSwitchMux( - ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle - ctl_display_output_handle_t hInactiveDisplayOutput ///< [out] Input selection for this MUX, which if active will drive the - ///< output of this MUX device. This should be one of the display output - ///< handles reported under this MUX device's properties. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intel Arc Sync profile -typedef enum _ctl_intel_arc_sync_profile_t -{ - CTL_INTEL_ARC_SYNC_PROFILE_INVALID = 0, ///< Invalid profile - CTL_INTEL_ARC_SYNC_PROFILE_RECOMMENDED = 1, ///< Default. Selects appropriate profile based on the monitor. COMPATIBLE - ///< profile is applied if profile is not available for the monitor - CTL_INTEL_ARC_SYNC_PROFILE_EXCELLENT = 2, ///< Unconstrained. Full VRR range of the monitor can be used - CTL_INTEL_ARC_SYNC_PROFILE_GOOD = 3, ///< Some minor range constraints, unlikely to effect user experience but - ///< can reduce flicker on some monitors - CTL_INTEL_ARC_SYNC_PROFILE_COMPATIBLE = 4, ///< Significant constraints that will reduce flicker considerably but are - ///< likely to cause some level of judder onscreen especially when refresh - ///< rates are changing rapidly - CTL_INTEL_ARC_SYNC_PROFILE_OFF = 5, ///< Disable Intel Arc Sync on this monitor. This disables variable rate - ///< flips on this monitor. All sync flips will occur at the OS requested - ///< refresh rate - CTL_INTEL_ARC_SYNC_PROFILE_VESA = 6, ///< Applies vesa specified constraints if the monitor has provided them, - ///< COMPATIBLE profile if not - CTL_INTEL_ARC_SYNC_PROFILE_CUSTOM = 7, ///< Unlocks controls to set a custom Intel Arc Sync profile - CTL_INTEL_ARC_SYNC_PROFILE_MAX - -} ctl_intel_arc_sync_profile_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intel Arc Sync Profile Params -typedef struct _ctl_intel_arc_sync_profile_params_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_intel_arc_sync_profile_t IntelArcSyncProfile; ///< [in,out] Intel Arc Sync profile used by driver. Refer - ///< ::ctl_intel_arc_sync_profile_t - float MaxRefreshRateInHz; ///< [in,out] Maximum refresh rate utilized by the driver - float MinRefreshRateInHz; ///< [in,out] Minimum refresh rate utilized by the driver - uint32_t MaxFrameTimeIncreaseInUs; ///< [in,out] Maximum frame time increase (in micro seconds) imposed by the - ///< driver - uint32_t MaxFrameTimeDecreaseInUs; ///< [in,out] Maximum frame time decrease (in micro seconds) imposed by the - ///< driver - -} ctl_intel_arc_sync_profile_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Intel Arc Sync profile -/// -/// @details -/// - Returns Intel Arc Sync profile for selected monitor -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pIntelArcSyncProfileParams` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetIntelArcSyncProfile( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_intel_arc_sync_profile_params_t* pIntelArcSyncProfileParams ///< [in,out][release] Intel Arc Sync params for monitor - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set Intel Arc Sync profile -/// -/// @details -/// - Sets Intel Arc Sync profile for selected monitor. In a mux situation, -/// this API should be called for all display IDs associated with a -/// physical display. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pIntelArcSyncProfileParams` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSetIntelArcSyncProfile( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_intel_arc_sync_profile_params_t* pIntelArcSyncProfileParams ///< [in][release] Intel Arc Sync params for monitor - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief EDID Management operation type -typedef enum _ctl_edid_management_optype_t -{ - CTL_EDID_MANAGEMENT_OPTYPE_READ_EDID = 1, ///< This operation type is to read an output's EDID. Set edid_type input - ///< arg to read MONITOR EDID or previously OVERRIDDEN EDID or CURRENT - ///< active EDID. Read EDID is a 2 pass call. First call with size = 0, - ///< pEdidBuf = nullptr to get the size, then call with allocated buffer to - ///< get the EDID data. READ operation is applicable for any normal, edid - ///< locked or edid overridden display output device. - CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID = 2, ///< To make an output always connected with OVERRIDE or MONITOR EDID - ///< across reboots. When output isn't connected call with OVERRIDE EDID; - ///< when connected, either set OVERRIDE and provide pEdidBuf or set - ///< MONITOR and driver will use monitor's EDID. There is no change to EDID - ///< stored in Monitor. Cannot be called when override is active. Any OS - ///< EDID override will take precedence over IGCL override. - CTL_EDID_MANAGEMENT_OPTYPE_UNLOCK_EDID = 3, ///< To undo lock EDID operation, i.e. it makes output as detached in - ///< response to unplug. This operation removes past supplied EDID; output - ///< status is reported to OS as it is; output restores back to monitor's - ///< EDID when it is connected - CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID = 4, ///< To replace an output's EDID with supplied one (pEdidBuf) only when - ///< physical display is connected. There is no change to EDID stored in - ///< Monitor. Cannot apply this operation on locked output. When no output - ///< device attached, the supplied EDID will be persisted in driver for - ///< future use. Any OS EDID override will take precedence over IGCL - ///< override. - CTL_EDID_MANAGEMENT_OPTYPE_UNDO_OVERRIDE_EDID = 5, ///< To undo override EDID operation, that is remove previously overridden - ///< EDID on an output. Output restores back to monitor's EDID when it is - ///< connected - CTL_EDID_MANAGEMENT_OPTYPE_MAX - -} ctl_edid_management_optype_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief EDID type. Used in LOCK_EDID and READ_EDID calls. -typedef enum _ctl_edid_type_t -{ - CTL_EDID_TYPE_CURRENT = 1, ///< [in] Used to return currently active EDID in READ_EDID call. - CTL_EDID_TYPE_OVERRIDE = 2, ///< [in] Is it user supplied EDID. Used in LOCK_EDID call with Supplied - ///< EDID or in READ_EDID to get Supplied EDID. - CTL_EDID_TYPE_MONITOR = 3, ///< [in] Is it Monitor's EDID. Used in LOCK_EDID and READ_EDID calls. - CTL_EDID_TYPE_MAX - -} ctl_edid_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Edid management operation Out Flags -typedef uint32_t ctl_edid_management_out_flags_t; -typedef enum _ctl_edid_management_out_flag_t -{ - CTL_EDID_MANAGEMENT_OUT_FLAG_OS_CONN_NOTIFICATION = CTL_BIT(0), ///< [out] If OS was notified about a connection change. App will need to - ///< wait for the OS action to complete. - CTL_EDID_MANAGEMENT_OUT_FLAG_SUPPLIED_EDID = CTL_BIT(1),///< [out] Is it previously supplied EDID, set for READ_EDID(CURRENT). - CTL_EDID_MANAGEMENT_OUT_FLAG_MONITOR_EDID = CTL_BIT(2), ///< [out] Is it Monitor's EDID, set for READ_EDID(CURRENT). - CTL_EDID_MANAGEMENT_OUT_FLAG_DISPLAY_CONNECTED = CTL_BIT(3),///< [out] Is Monitor physically connected - CTL_EDID_MANAGEMENT_OUT_FLAG_MAX = 0x80000000 - -} ctl_edid_management_out_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief EDID management -typedef struct _ctl_edid_management_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_edid_management_optype_t OpType; ///< [in] EDID managmeent operation type - ctl_edid_type_t EdidType; ///< [in] EDID Type, Monitor or Supplied - uint32_t EdidSize; ///< [in,out] EDID Size, should be 0 for querying the size of EDID, should - ///< be previously returned size to read EDID. if buffer isn't big enough - ///< to fit EDID, returns size of EDID bytes. - uint8_t* pEdidBuf; ///< [in,out] buffer holding EDID data - ctl_edid_management_out_flags_t OutFlags; ///< [out] Output flags to inform about status of EDID management - ///< operations - -} ctl_edid_management_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief EDID Management allows managing an output's EDID or Plugged Status. -/// -/// @details -/// - To manage output's EDID or Display ID. Supports native DP SST and HDMI -/// Display types. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pEdidManagementArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" -/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ATTACHED - "Error for Output Device not attached" -/// - ::CTL_RESULT_ERROR_OUT_OF_DEVICE_MEMORY - "Insufficient device memory to satisfy call" -/// - ::CTL_RESULT_ERROR_DATA_NOT_FOUND - "Requested EDID data not present." -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEdidManagement( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_edid_management_args_t* pEdidManagementArgs ///< [in,out] EDID management arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Custom mode operation types -typedef enum _ctl_custom_mode_operation_types_t -{ - CTL_CUSTOM_MODE_OPERATION_TYPES_GET_CUSTOM_SOURCE_MODES = 0,///< Get details of all previous applied custom modes if any. - CTL_CUSTOM_MODE_OPERATION_TYPES_ADD_CUSTOM_SOURCE_MODE = 1, ///< Add a new mode. Allows only single mode adition at a time. - CTL_CUSTOM_MODE_OPERATION_TYPES_REMOVE_CUSTOM_SOURCE_MODES = 2, ///< Remove previously added custom mode. Allows single or multiple mode - ///< removal at a time. - CTL_CUSTOM_MODE_OPERATION_TYPES_MAX - -} ctl_custom_mode_operation_types_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Custom Mode -typedef struct _ctl_get_set_custom_mode_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_custom_mode_operation_types_t CustomModeOpType; ///< [in] Custom mode operation type - uint32_t NumOfModes; ///< [in,out] Number of Custom Src Modes to be added/removed/Read. - ctl_custom_src_mode_t* pCustomSrcModeList; ///< [in,out] Custom mode source list which holds source modes to be - ///< added/removed/Read. - -} ctl_get_set_custom_mode_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Custom Mode -typedef struct _ctl_custom_src_mode_t -{ - uint32_t SourceX; ///< [in,out] CustomMode Source X Size - uint32_t SourceY; ///< [in,out] CustomMode Source Y Size - -} ctl_custom_src_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Custom mode. -/// -/// @details -/// - To get or set custom mode. -/// - Add custom source mode operation supports only single mode additon at -/// a time. -/// - Remove custom source mode operation supports single or multiple mode -/// removal at a time. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCustomModeArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" -/// - ::CTL_RESULT_ERROR_CUSTOM_MODE_STANDARD_CUSTOM_MODE_EXISTS - "Standard custom mode exists" -/// - ::CTL_RESULT_ERROR_CUSTOM_MODE_NON_CUSTOM_MATCHING_MODE_EXISTS - "Non custom matching mode exists" -/// - ::CTL_RESULT_ERROR_CUSTOM_MODE_INSUFFICIENT_MEMORY - "Custom mode insufficent memory" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSetCustomMode( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_get_set_custom_mode_args_t* pCustomModeArgs ///< [in,out] Custom mode arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Combined Display operation type -typedef enum _ctl_combined_display_optype_t -{ - CTL_COMBINED_DISPLAY_OPTYPE_IS_SUPPORTED_CONFIG = 1,///< To check whether given outputs can form a combined display, no changes - ///< are applied - CTL_COMBINED_DISPLAY_OPTYPE_ENABLE = 2, ///< To setup and enable a combined display - CTL_COMBINED_DISPLAY_OPTYPE_DISABLE = 3, ///< To disable combined display - CTL_COMBINED_DISPLAY_OPTYPE_QUERY_CONFIG = 4, ///< To query combined display configuration - CTL_COMBINED_DISPLAY_OPTYPE_MAX - -} ctl_combined_display_optype_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Combined Display's child display target mode -typedef struct _ctl_child_display_target_mode_t -{ - uint32_t Width; ///< [in,out] Width - uint32_t Height; ///< [in,out] Height - float RefreshRate; ///< [in,out] Refresh Rate - uint32_t ReservedFields[4]; ///< [out] Reserved field of 16 bytes - -} ctl_child_display_target_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Combined Display's child display information -typedef struct _ctl_combined_display_child_info_t -{ - ctl_display_output_handle_t hDisplayOutput; ///< [in,out] Display output handle under combined display configuration - ctl_rect_t FbSrc; ///< [in,out] FrameBuffer source's RECT within Combined Display respective - ctl_rect_t FbPos; ///< [in,out] FrameBuffer target's RECT within output size - ctl_display_orientation_t DisplayOrientation; ///< [in,out] 0/180 Degree Display orientation (rotation) - ctl_child_display_target_mode_t TargetMode; ///< [in,out] Desired target mode (width, height, refresh) - -} ctl_combined_display_child_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Combined Display arguments -typedef struct _ctl_combined_display_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_combined_display_optype_t OpType; ///< [in] Combined display operation type - bool IsSupported; ///< [out] Returns yes/no in response to IS_SUPPORTED_CONFIG command - uint8_t NumOutputs; ///< [in,out] Number of outputs part of desired combined display - ///< configuration - uint32_t CombinedDesktopWidth; ///< [in,out] Width of desired combined display configuration - uint32_t CombinedDesktopHeight; ///< [in,out] Height of desired combined display configuration - ctl_combined_display_child_info_t* pChildInfo; ///< [in,out] List of child display information respective to each output. - ///< Up to 16 displays are supported with up to 4 displays per GPU. - ctl_display_output_handle_t hCombinedDisplayOutput; ///< [in,out] Handle to combined display output - -} ctl_combined_display_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Combined Display -/// -/// @details -/// - To get or set combined display with given Child Targets on a Single -/// GPU or across identical GPUs. Multi-GPU(MGPU) combined display is -/// reserved i.e. it is not public and requires special application GUID. -/// MGPU Combined Display will get activated or deactivated in next boot. -/// MGPU scenario will internally link the associated adapters via Linked -/// Display Adapter Call, with supplied hDeviceAdapter being the LDA -/// Primary. If Genlock and enabled in Driver registry and supported by -/// given Display Config, MGPU Combined Display will enable MGPU Genlock -/// with supplied hDeviceAdapter being the Genlock Primary Adapter and the -/// First Child Display being the Primary Display. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceAdapter` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCombinedDisplayArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -/// - ::CTL_RESULT_ERROR_FEATURE_NOT_SUPPORTED - "Combined Display feature is not supported in this platform" -/// - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSetCombinedDisplay( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] Handle to control device adapter - ctl_combined_display_args_t* pCombinedDisplayArgs ///< [in,out] Setup and get combined display arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Display Genlock Operations -typedef enum _ctl_genlock_operation_t -{ - CTL_GENLOCK_OPERATION_GET_TIMING_DETAILS = 0, ///< Get details of GENLOCK support and timing information - CTL_GENLOCK_OPERATION_VALIDATE = 1, ///< Driver to verify that the topology is Genlock capable - CTL_GENLOCK_OPERATION_ENABLE = 2, ///< Enable GENLOCK - CTL_GENLOCK_OPERATION_DISABLE = 3, ///< Disable GENLOCK - CTL_GENLOCK_OPERATION_GET_TOPOLOGY = 4, ///< Get details of the current Genlock topology that is applied - CTL_GENLOCK_OPERATION_MAX - -} ctl_genlock_operation_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Display Genlock Info -typedef struct _ctl_genlock_display_info_t -{ - ctl_display_output_handle_t hDisplayOutput; ///< [in,out] Display output handle under Genlock topology - bool IsPrimary; ///< [in,out] Genlock Primary - -} ctl_genlock_display_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Genlock Target Mode List -typedef struct _ctl_genlock_target_mode_list_t -{ - ctl_display_output_handle_t hDisplayOutput; ///< [in] Display output handle for whom target mode list is required - uint32_t NumModes; ///< [in,out] Number of supported Modes that is returned from a driver - ctl_display_timing_t* pTargetModes; ///< [out] Display Genlock operation and information - -} ctl_genlock_target_mode_list_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Genlock Topology -typedef struct _ctl_genlock_topology_t -{ - uint8_t NumGenlockDisplays; ///< [in,out] Number of Genlock displays - bool IsPrimaryGenlockSystem; ///< [in,out] Primary Genlock system - ctl_display_timing_t CommonTargetMode; ///< [in] Common target mode - ctl_genlock_display_info_t* pGenlockDisplayInfo;///< [in,out] List of Genlock display info - ctl_genlock_target_mode_list_t* pGenlockModeList; ///< [out] List of Genlock target modes - -} ctl_genlock_topology_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Display Genlock Arg type -typedef struct _ctl_genlock_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_genlock_operation_t Operation; ///< [in] Display Genlock Operation - ctl_genlock_topology_t GenlockTopology; ///< [in,out] Display Genlock array of topology structures - bool IsGenlockEnabled; ///< [out] Whether the feature is currently enabled or not - bool IsGenlockPossible; ///< [out] Indicates if Genlock can be enabled/disabled with the given - ///< topology - -} ctl_genlock_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Display Genlock -/// -/// @details -/// - To get or set Display Genlock. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == hDeviceAdapter` -/// + `nullptr == pGenlockArgs` -/// + `nullptr == hFailureDeviceAdapter` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid topology structure size" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSetDisplayGenlock( - ctl_device_adapter_handle_t* hDeviceAdapter, ///< [in][release] Handle to control device adapter - ctl_genlock_args_t* pGenlockArgs, ///< [in,out] Display Genlock operation and information - uint32_t AdapterCount, ///< [in] Number of device adapters - ctl_device_adapter_handle_t* hFailureDeviceAdapter ///< [out] Handle to address the failure device adapter in an error case - ); - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_MAX_DISPLAYS_FOR_MGPU_COLLAGE -/// @brief Maximum number of displays for Single Large Screen -#define CTL_MAX_DISPLAYS_FOR_MGPU_COLLAGE 16 -#endif // CTL_MAX_DISPLAYS_FOR_MGPU_COLLAGE - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Vblank timestamp arguments -typedef struct _ctl_vblank_ts_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint8_t NumOfTargets; ///< [out] Number of child targets - uint64_t VblankTS[CTL_MAX_DISPLAYS_FOR_MGPU_COLLAGE]; ///< [out] List of vblank timestamps in microseconds per child target - -} ctl_vblank_ts_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Vblank Timestamp -/// -/// @details -/// - To get a list of vblank timestamps in microseconds for each child -/// target of a display. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pVblankTSArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetVblankTimestamp( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_vblank_ts_args_t* pVblankTSArgs ///< [out] Get vblank timestamp arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Link Display Adapters Arguments -typedef struct _ctl_lda_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint8_t NumAdapters; ///< [in,out] Numbers of adapters to be linked. Up to 4 adapters are - ///< supported - ctl_device_adapter_handle_t* hLinkedAdapters; ///< [in,out][release] List of Control device adapter handles to be linked, - ///< first one being Primary Adapter - uint64_t Reserved[4]; ///< [out] Reserved fields. Set to zero. - -} ctl_lda_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Link Display Adapters -/// -/// @details -/// - To Link Display Adapters. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPrimaryAdapter` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pLdaArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -/// - ::CTL_RESULT_ERROR_ADAPTER_ALREADY_LINKED - "Adapter is already linked" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlLinkDisplayAdapters( - ctl_device_adapter_handle_t hPrimaryAdapter, ///< [in][release] Handle to Primary adapter in LDA chain - ctl_lda_args_t* pLdaArgs ///< [in] Link Display Adapters Arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Unlink Display Adapters -/// -/// @details -/// - To Unlink Display Adapters -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPrimaryAdapter` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -/// - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlUnlinkDisplayAdapters( - ctl_device_adapter_handle_t hPrimaryAdapter ///< [in][release] Handle to Primary adapter in LDA chain - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Linked Display Adapters -/// -/// @details -/// - To return list of Linked Display Adapters. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPrimaryAdapter` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pLdaArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -/// - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetLinkedDisplayAdapters( - ctl_device_adapter_handle_t hPrimaryAdapter, ///< [in][release] Handle to Primary adapter in LDA chain - ctl_lda_args_t* pLdaArgs ///< [out] Link Display Adapters Arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Dynamic Contrast Enhancement arguments -typedef struct _ctl_dce_args_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool Set; ///< [in] Flag to indicate Set or Get operation - uint32_t TargetBrightnessPercent; ///< [in] Target brightness percent - double PhaseinSpeedMultiplier; ///< [in] Phase-in speed multiplier for brightness to take effect - uint32_t NumBins; ///< [in,out] Number of histogram bins - bool Enable; ///< [in,out] For get calls, this represents current state & for set this - ///< represents future state - bool IsSupported; ///< [out] is DCE feature supported - uint32_t* pHistogram; ///< [out] Bin wise histogram data of size NumBins * sizeof(uint32_t) for - ///< current frame - -} ctl_dce_args_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Dynamic Contrast Enhancement -/// -/// @details -/// - To get the DCE feature status and, if feature is enabled, returns the -/// current histogram, or to set the brightness at the phase-in speed -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pDceArgs` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSetDynamicContrastEnhancement( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_dce_args_t* pDceArgs ///< [in,out] Dynamic Contrast Enhancement arguments - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Color model -typedef enum _ctl_wire_format_color_model_t -{ - CTL_WIRE_FORMAT_COLOR_MODEL_RGB = 0, ///< Color model RGB - CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_420 = 1, ///< Color model YCBCR 420 - CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_422 = 2, ///< Color model YCBCR 422 - CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_444 = 3, ///< Color model YCBCR 444 - CTL_WIRE_FORMAT_COLOR_MODEL_MAX - -} ctl_wire_format_color_model_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Operation type -typedef enum _ctl_wire_format_operation_type_t -{ - CTL_WIRE_FORMAT_OPERATION_TYPE_GET = 0, ///< Get request - CTL_WIRE_FORMAT_OPERATION_TYPE_SET = 1, ///< Set request - CTL_WIRE_FORMAT_OPERATION_TYPE_RESTORE_DEFAULT = 2, ///< Restore to default values - CTL_WIRE_FORMAT_OPERATION_TYPE_MAX - -} ctl_wire_format_operation_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Wire Format -typedef struct _ctl_wire_format_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_wire_format_color_model_t ColorModel; ///< [in,out] Color model - ctl_output_bpc_flags_t ColorDepth; ///< [in,out] Color Depth - -} ctl_wire_format_t; - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED -/// @brief Maximum Wire Formats Supported -#define CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED 4 -#endif // CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Set Wire Format -typedef struct _ctl_get_set_wire_format_config_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_wire_format_operation_type_t Operation; ///< [in] Get/Set Operation - ctl_wire_format_t SupportedWireFormat[CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED]; ///< [out] Array of WireFormats supported - ctl_wire_format_t WireFormat; ///< [in,out] Current/Requested WireFormat based on Operation. During SET - ///< Operation, if multiple bpc is set, the MIN bpc will be applied - -} ctl_get_set_wire_format_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Color Format and Color Depth -/// -/// @details -/// - Get and Set the Color Format and Color Depth of a target -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pGetSetWireFormatSetting` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid data passed as argument, WireFormat is not supported" -/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSetWireFormat( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_get_set_wire_format_config_t* pGetSetWireFormatSetting ///< [in][release] Get/Set Wire Format settings to be fetched/applied - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Various display settings -typedef uint32_t ctl_display_setting_flags_t; -typedef enum _ctl_display_setting_flag_t -{ - CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY = CTL_BIT(0), ///< Low latency - CTL_DISPLAY_SETTING_FLAG_SOURCE_TM = CTL_BIT(1),///< Source tone mapping - CTL_DISPLAY_SETTING_FLAG_CONTENT_TYPE = CTL_BIT(2), ///< Content type - CTL_DISPLAY_SETTING_FLAG_QUANTIZATION_RANGE = CTL_BIT(3), ///< Quantization range, full range or limited range - CTL_DISPLAY_SETTING_FLAG_PICTURE_AR = CTL_BIT(4), ///< Picture aspect ratio - CTL_DISPLAY_SETTING_FLAG_AUDIO = CTL_BIT(5), ///< Audio settings - CTL_DISPLAY_SETTING_FLAG_MAX = 0x80000000 - -} ctl_display_setting_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Low latency setting -typedef enum _ctl_display_setting_low_latency_t -{ - CTL_DISPLAY_SETTING_LOW_LATENCY_DEFAULT = 0, ///< Default - CTL_DISPLAY_SETTING_LOW_LATENCY_DISABLED = 1, ///< Disabled - CTL_DISPLAY_SETTING_LOW_LATENCY_ENABLED = 2, ///< Enabled - CTL_DISPLAY_SETTING_LOW_LATENCY_MAX - -} ctl_display_setting_low_latency_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Source tone mapping setting -typedef enum _ctl_display_setting_sourcetm_t -{ - CTL_DISPLAY_SETTING_SOURCETM_DEFAULT = 0, ///< Default - CTL_DISPLAY_SETTING_SOURCETM_DISABLED = 1, ///< Disabled - CTL_DISPLAY_SETTING_SOURCETM_ENABLED = 2, ///< Enabled - CTL_DISPLAY_SETTING_SOURCETM_MAX - -} ctl_display_setting_sourcetm_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Content type settings -typedef enum _ctl_display_setting_content_type_t -{ - CTL_DISPLAY_SETTING_CONTENT_TYPE_DEFAULT = 0, ///< Default content type used by driver. Driver will use internal - ///< techniques to determine content type and indicate to panel - CTL_DISPLAY_SETTING_CONTENT_TYPE_DISABLED = 1, ///< Content type indication is disabled - CTL_DISPLAY_SETTING_CONTENT_TYPE_DESKTOP = 2, ///< Typical desktop with a mix of text and graphics - CTL_DISPLAY_SETTING_CONTENT_TYPE_MEDIA = 3, ///< Video or media content - CTL_DISPLAY_SETTING_CONTENT_TYPE_GAMING = 4, ///< Gaming content - CTL_DISPLAY_SETTING_CONTENT_TYPE_MAX - -} ctl_display_setting_content_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Quantization range -typedef enum _ctl_display_setting_quantization_range_t -{ - CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_DEFAULT = 0, ///< Default based on video format - CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_LIMITED_RANGE = 1, ///< Limited range - CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_FULL_RANGE = 2, ///< Full range - CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_MAX - -} ctl_display_setting_quantization_range_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Picture aspect ratio -typedef uint32_t ctl_display_setting_picture_ar_flags_t; -typedef enum _ctl_display_setting_picture_ar_flag_t -{ - CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DEFAULT = CTL_BIT(0), ///< Default picture aspect ratio - CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DISABLED = CTL_BIT(1), ///< Picture aspect ratio indication is explicitly disabled - CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_4_3 = CTL_BIT(2),///< Aspect ratio of 4:3 - CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_16_9 = CTL_BIT(3), ///< Aspect ratio of 16:9 - CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_64_27 = CTL_BIT(4), ///< Aspect ratio of 64:27 or 21:9 anamorphic - CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_256_135 = CTL_BIT(5),///< Aspect ratio of 256:135 - CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_MAX = 0x80000000 - -} ctl_display_setting_picture_ar_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Audio settings -typedef enum _ctl_display_setting_audio_t -{ - CTL_DISPLAY_SETTING_AUDIO_DEFAULT = 0, ///< Default audio settings, always enumerated and enabled if display - ///< supports it - CTL_DISPLAY_SETTING_AUDIO_DISABLED = 1, ///< Forcefully disable display audio end point enumeration to OS - CTL_DISPLAY_SETTING_AUDIO_MAX - -} ctl_display_setting_audio_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set end display settings -typedef struct _ctl_display_settings_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool Set; ///< [in] Flag to indicate Set or Get operation. Default option for all - ///< features are reserved for Set=true calls, which will reset the setting - ///< to driver defaults. - ctl_display_setting_flags_t SupportedFlags; ///< [out] Display setting flags supported by the display. - ctl_display_setting_flags_t ControllableFlags; ///< [out] Display setting flags which can be controlled by the caller. - ///< Features which doesn't have this flag set cannot be changed by caller. - ctl_display_setting_flags_t ValidFlags; ///< [in,out] Display setting flags which caller can use to indicate the - ///< features it's interested in. This cannot have a bit set which is not - ///< supported by SupportedFlags and ControllableFlags. - ctl_display_setting_low_latency_t LowLatency; ///< [in,out] Low latency state of panel. For HDR10+ Gaming this need to be - ///< in ENABLED state. - ctl_display_setting_sourcetm_t SourceTM; ///< [in,out] Source tone mapping state known to panel. For HDR10+ Gaming - ///< this need to be in ENABLED state. - ctl_display_setting_content_type_t ContentType; ///< [in,out] Source content type known to panel. - ctl_display_setting_quantization_range_t QuantizationRange; ///< [in,out] Quantization range - ctl_display_setting_picture_ar_flags_t SupportedPictureAR; ///< [out] Supported Picture aspect ratios - ctl_display_setting_picture_ar_flag_t PictureAR;///< [in,out] Picture aspect ratio - ctl_display_setting_audio_t AudioSettings; ///< [in,out] Audio settings - uint32_t Reserved[25]; ///< [out] Reserved fields for future enumerations - -} ctl_display_settings_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Display settings -/// -/// @details -/// - To get/set end display settings like low latency, HDR10+ signaling -/// etc. which are controlled via info-frames/secondary data packets -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDisplayOutput` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pDisplaySettings` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" -/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSetDisplaySettings( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_display_settings_t* pDisplaySettings ///< [in,out] End display capabilities - ); - - -#if !defined(__GNUC__) -#pragma endregion // display -#endif -// Intel 'ctlApi' for Device Adapter - Engine groups -#if !defined(__GNUC__) -#pragma region engine -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Accelerator engine groups -typedef enum _ctl_engine_group_t -{ - CTL_ENGINE_GROUP_GT = 0, ///< Access information about all engines combined. - CTL_ENGINE_GROUP_RENDER = 1, ///< Access information about all render and compute engines combined. - CTL_ENGINE_GROUP_MEDIA = 2, ///< Access information about all media engines combined. - CTL_ENGINE_GROUP_MAX - -} ctl_engine_group_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Engine group properties -typedef struct _ctl_engine_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_engine_group_t type; ///< [out] The engine group - -} ctl_engine_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Engine activity counters -/// -/// @details -/// - Percent utilization is calculated by taking two snapshots (s1, s2) and -/// using the equation: %util = (s2.activeTime - s1.activeTime) / -/// (s2.timestamp - s1.timestamp) -typedef struct _ctl_engine_stats_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint64_t activeTime; ///< [out] Monotonic counter for time in microseconds that this resource is - ///< actively running workloads. - uint64_t timestamp; ///< [out] Monotonic timestamp counter in microseconds when activeTime - ///< counter was sampled. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - -} ctl_engine_stats_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of engine groups -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumEngineGroups( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get engine group properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hEngine` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEngineGetProperties( - ctl_engine_handle_t hEngine, ///< [in] Handle for the component. - ctl_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the activity stats for an engine group -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hEngine` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pStats` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEngineGetActivity( - ctl_engine_handle_t hEngine, ///< [in] Handle for the component. - ctl_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity - ///< counters. - ); - - -#if !defined(__GNUC__) -#pragma endregion // engine -#endif -// Intel 'ctlApi' for Device Adapter- Fan management -#if !defined(__GNUC__) -#pragma region fan -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan resource speed mode -typedef enum _ctl_fan_speed_mode_t -{ - CTL_FAN_SPEED_MODE_DEFAULT = 0, ///< The fan speed is operating using the hardware default settings - CTL_FAN_SPEED_MODE_FIXED = 1, ///< The fan speed is currently set to a fixed value - CTL_FAN_SPEED_MODE_TABLE = 2, ///< The fan speed is currently controlled dynamically by hardware based on - ///< a temp/speed table - CTL_FAN_SPEED_MODE_MAX - -} ctl_fan_speed_mode_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan speed units -typedef enum _ctl_fan_speed_units_t -{ - CTL_FAN_SPEED_UNITS_RPM = 0, ///< The fan speed is in units of revolutions per minute (rpm) - CTL_FAN_SPEED_UNITS_PERCENT = 1, ///< The fan speed is a percentage of the maximum speed of the fan - CTL_FAN_SPEED_UNITS_MAX - -} ctl_fan_speed_units_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan speed -typedef struct _ctl_fan_speed_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - int32_t speed; ///< [in,out] The speed of the fan. On output, a value of -1 indicates that - ///< there is no fixed fan speed setting. - ctl_fan_speed_units_t units; ///< [in,out] The units that the fan speed is expressed in. On output, if - ///< fan speed is -1 then units should be ignored. - -} ctl_fan_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan temperature/speed pair -typedef struct _ctl_fan_temp_speed_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t temperature; ///< [in,out] Temperature in degrees Celsius. - ctl_fan_speed_t speed; ///< [in,out] The speed of the fan - -} ctl_fan_temp_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_FAN_TEMP_SPEED_PAIR_COUNT -/// @brief Maximum number of fan temperature/speed pairs in the fan speed table. -#define CTL_FAN_TEMP_SPEED_PAIR_COUNT 32 -#endif // CTL_FAN_TEMP_SPEED_PAIR_COUNT - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan speed table -typedef struct _ctl_fan_speed_table_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - int32_t numPoints; ///< [in,out] The number of valid points in the fan speed table. 0 means - ///< that there is no fan speed table configured. -1 means that a fan speed - ///< table is not supported by the hardware. - ctl_fan_temp_speed_t table[CTL_FAN_TEMP_SPEED_PAIR_COUNT]; ///< [in,out] Array of temperature/fan speed pairs. The table is ordered - ///< based on temperature from lowest to highest. - -} ctl_fan_speed_table_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan properties -typedef struct _ctl_fan_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool canControl; ///< [out] Indicates if software can control the fan speed assuming the - ///< user has permissions - uint32_t supportedModes; ///< [out] Bitfield of supported fan configuration modes - ///< (1<<::ctl_fan_speed_mode_t) - uint32_t supportedUnits; ///< [out] Bitfield of supported fan speed units - ///< (1<<::ctl_fan_speed_units_t) - int32_t maxRPM; ///< [out] The maximum RPM of the fan. A value of -1 means that this - ///< property is unknown. - int32_t maxPoints; ///< [out] The maximum number of points in the fan temp/speed table. A - ///< value of -1 means that this fan doesn't support providing a temp/speed - ///< table. - -} ctl_fan_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Fan configuration -typedef struct _ctl_fan_config_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_fan_speed_mode_t mode; ///< [in,out] The fan speed mode (fixed, temp-speed table) - ctl_fan_speed_t speedFixed; ///< [in,out] The current fixed fan speed setting - ctl_fan_speed_table_t speedTable; ///< [out] A table containing temperature/speed pairs - -} ctl_fan_config_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of fans -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumFans( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to the adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get fan properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFanGetProperties( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - ctl_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get fan configurations and the current fan speed mode (default, fixed, -/// temp-speed table) -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pConfig` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFanGetConfig( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - ctl_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configure the fan to run with hardware factory settings (set mode to -/// ::CTL_FAN_SPEED_MODE_DEFAULT) -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFanSetDefaultMode( - ctl_fan_handle_t hFan ///< [in] Handle for the component. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configure the fan to rotate at a fixed speed (set mode to -/// ::CTL_FAN_SPEED_MODE_FIXED) -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == speed` -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Fixing the fan speed not supported by the hardware or the fan speed units are not supported. See ::ctl_fan_properties_t.supportedModes and ::ctl_fan_properties_t.supportedUnits. -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFanSetFixedSpeedMode( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - const ctl_fan_speed_t* speed ///< [in] The fixed fan speed setting - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Configure the fan to adjust speed based on a temperature/speed table -/// (set mode to ::CTL_FAN_SPEED_MODE_TABLE) -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == speedTable` -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT -/// + The temperature/speed pairs in the array are not sorted on temperature from lowest to highest. -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + Fan speed table not supported by the hardware or the fan speed units are not supported. See ::ctl_fan_properties_t.supportedModes and ::ctl_fan_properties_t.supportedUnits. -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFanSetSpeedTableMode( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - const ctl_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current state of a fan - current mode and speed -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFan` -/// - CTL_RESULT_ERROR_INVALID_ENUMERATION -/// + `::CTL_FAN_SPEED_UNITS_PERCENT < units` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSpeed` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE -/// + The requested fan speed units are not supported. See ::ctl_fan_properties_t.supportedUnits. -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFanGetState( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - ctl_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. - int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units - ///< requested. A value of -1 indicates that the fan speed cannot be - ///< measured. - ); - - -#if !defined(__GNUC__) -#pragma endregion // fan -#endif -// Intel 'ctlApi' for Device Adapter - Frequency domains -#if !defined(__GNUC__) -#pragma region frequency -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency domains. -typedef enum _ctl_freq_domain_t -{ - CTL_FREQ_DOMAIN_GPU = 0, ///< GPU Core Domain. - CTL_FREQ_DOMAIN_MEMORY = 1, ///< Local Memory Domain. - CTL_FREQ_DOMAIN_MAX - -} ctl_freq_domain_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency properties -typedef struct _ctl_freq_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_freq_domain_t type; ///< [out] The hardware block that this frequency domain controls (GPU, - ///< memory, ...) - bool canControl; ///< [out] Indicates if software can control the frequency of this domain - ///< assuming the user has permissions - double min; ///< [out] The minimum hardware clock frequency in units of MHz. - double max; ///< [out] The maximum non-overclock hardware clock frequency in units of - ///< MHz. - -} ctl_freq_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency range between which the hardware can operate. The limits can -/// be above or below the hardware limits - the hardware will clamp -/// appropriately. -typedef struct _ctl_freq_range_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - double min; ///< [in,out] The min frequency in MHz below which hardware frequency - ///< management will not request frequencies. On input, setting to 0 will - ///< permit the frequency to go down to the hardware minimum. On output, a - ///< negative value indicates that no external minimum frequency limit is - ///< in effect. - double max; ///< [in,out] The max frequency in MHz above which hardware frequency - ///< management will not request frequencies. On input, setting to 0 or a - ///< very big number will permit the frequency to go all the way up to the - ///< hardware maximum. On output, a negative number indicates that no - ///< external maximum frequency limit is in effect. - -} ctl_freq_range_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency throttle reasons -typedef uint32_t ctl_freq_throttle_reason_flags_t; -typedef enum _ctl_freq_throttle_reason_flag_t -{ - CTL_FREQ_THROTTLE_REASON_FLAG_AVE_PWR_CAP = CTL_BIT(0), ///< frequency throttled due to average power excursion (PL1) - CTL_FREQ_THROTTLE_REASON_FLAG_BURST_PWR_CAP = CTL_BIT(1), ///< frequency throttled due to burst power excursion (PL2) - CTL_FREQ_THROTTLE_REASON_FLAG_CURRENT_LIMIT = CTL_BIT(2), ///< frequency throttled due to current excursion (PL4) - CTL_FREQ_THROTTLE_REASON_FLAG_THERMAL_LIMIT = CTL_BIT(3), ///< frequency throttled due to thermal excursion (T > TjMax) - CTL_FREQ_THROTTLE_REASON_FLAG_PSU_ALERT = CTL_BIT(4), ///< frequency throttled due to power supply assertion - CTL_FREQ_THROTTLE_REASON_FLAG_SW_RANGE = CTL_BIT(5),///< frequency throttled due to software supplied frequency range - CTL_FREQ_THROTTLE_REASON_FLAG_HW_RANGE = CTL_BIT(6),///< frequency throttled due to a sub block that has a lower frequency - ///< range when it receives clocks - CTL_FREQ_THROTTLE_REASON_FLAG_MAX = 0x80000000 - -} ctl_freq_throttle_reason_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency state -typedef struct _ctl_freq_state_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - double currentVoltage; ///< [out] Current voltage in Volts. A negative value indicates that this - ///< property is not known. - double request; ///< [out] The current frequency request in MHz. A negative value indicates - ///< that this property is not known. - double tdp; ///< [out] The maximum frequency in MHz supported under the current TDP - ///< conditions. This fluctuates dynamically based on the power and thermal - ///< limits of the part. A negative value indicates that this property is - ///< not known. - double efficient; ///< [out] The efficient minimum frequency in MHz. A negative value - ///< indicates that this property is not known. - double actual; ///< [out] The resolved frequency in MHz. A negative value indicates that - ///< this property is not known. - ctl_freq_throttle_reason_flags_t throttleReasons; ///< [out] The reasons that the frequency is being limited by the hardware. - ///< Returns 0 (frequency not throttled) or a combination of ::ctl_freq_throttle_reason_flag_t. - -} ctl_freq_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Frequency throttle time snapshot -/// -/// @details -/// - Percent time throttled is calculated by taking two snapshots (s1, s2) -/// and using the equation: %throttled = (s2.throttleTime - -/// s1.throttleTime) / (s2.timestamp - s1.timestamp) -typedef struct _ctl_freq_throttle_time_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint64_t throttleTime; ///< [out] The monotonic counter of time in microseconds that the frequency - ///< has been limited by the hardware. - uint64_t timestamp; ///< [out] Microsecond timestamp when throttleTime was captured. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - -} ctl_freq_throttle_time_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of frequency domains -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumFrequencyDomains( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get frequency properties - available frequencies -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFrequencyGetProperties( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - ctl_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get available non-overclocked hardware clock frequencies for the -/// frequency domain -/// -/// @details -/// - The list of available frequencies is returned in order of slowest to -/// fastest. -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFrequencyGetAvailableClocks( - ctl_freq_handle_t hFrequency, ///< [in] Device handle of the device. - uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. - ///< if count is zero, then the driver shall update the value with the - ///< total number of frequencies that are available. - ///< if count is greater than the number of frequencies that are available, - ///< then the driver shall update the value with the correct number of frequencies. - double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of - ///< MHz and sorted from slowest to fastest. - ///< if count is less than the number of frequencies that are available, - ///< then the driver shall only retrieve that number of frequencies. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current frequency limits -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pLimits` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFrequencyGetRange( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - ctl_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the - ///< specified domain. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set frequency range between which the hardware can operate. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pLimits` -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFrequencySetRange( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - const ctl_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the - ///< specified domain. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current frequency state - frequency request, actual frequency, TDP -/// limits -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFrequencyGetState( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - ctl_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get frequency throttle time -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hFrequency` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pThrottleTime` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlFrequencyGetThrottleTime( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - ctl_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the - ///< specified domain. - ); - - -#if !defined(__GNUC__) -#pragma endregion // frequency -#endif -// Intel 'ctlApi' for Device Adapter -#if !defined(__GNUC__) -#pragma region media -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Feature type -typedef enum _ctl_video_processing_feature_t -{ - CTL_VIDEO_PROCESSING_FEATURE_FILM_MODE_DETECTION = 0, ///< Film mode detection. Contains CTL_PROPERTY_VALUE_TYPE_BOOL ValueType. - CTL_VIDEO_PROCESSING_FEATURE_NOISE_REDUCTION = 1, ///< Noise reduction. Contains CTL_PROPERTY_VALUE_TYPE_CUSTOM type field - ///< using struct ::ctl_video_processing_noise_reduction_t. - CTL_VIDEO_PROCESSING_FEATURE_SHARPNESS = 2, ///< Sharpness. Contains CTL_PROPERTY_VALUE_TYPE_UINT32 ValueType. - CTL_VIDEO_PROCESSING_FEATURE_ADAPTIVE_CONTRAST_ENHANCEMENT = 3, ///< Adaptive contrast enhancement. Contains - ///< CTL_PROPERTY_VALUE_TYPE_CUSTOM type field using struct - ///< ::ctl_video_processing_adaptive_contrast_enhancement_t. - CTL_VIDEO_PROCESSING_FEATURE_SUPER_RESOLUTION = 4, ///< Super resolution. Contains CTL_PROPERTY_VALUE_TYPE_CUSTOM ValueType - ///< using ::ctl_video_processing_super_resolution_t. By defaut, Super - ///< resolution is not active, need application to activate it, please - ///< contact Intel for super resolution activation. - CTL_VIDEO_PROCESSING_FEATURE_STANDARD_COLOR_CORRECTION = 5, ///< Standard color correction. Controls Hue, Saturation, Contrast, - ///< Brightness. Contains CTL_PROPERTY_VALUE_TYPE_CUSTOM type field using - ///< struct ::ctl_video_processing_standard_color_correction_t. - CTL_VIDEO_PROCESSING_FEATURE_TOTAL_COLOR_CORRECTION = 6,///< Total color correction. Controls Red, Green, Blue, Yellow, Cyan, - ///< Magenta. Contains CTL_PROPERTY_VALUE_TYPE_CUSTOM type field using - ///< struct ::ctl_video_processing_total_color_correction_t. - CTL_VIDEO_PROCESSING_FEATURE_SKIN_TONE_ENHANCEMENT = 7, ///< Skin tone enhancement. Contains CTL_PROPERTY_VALUE_TYPE_UINT32 - ///< ValueType. - CTL_VIDEO_PROCESSING_FEATURE_MAX - -} ctl_video_processing_feature_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Super resolution values possible -typedef uint32_t ctl_video_processing_super_resolution_flags_t; -typedef enum _ctl_video_processing_super_resolution_flag_t -{ - CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_DISABLE = CTL_BIT(0),///< Disable - CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_ENABLE_DEFAULT_SCENARIO_MODE = CTL_BIT(1), ///< Enable with default super resolution mode - CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_ENABLE_CONFERENCE_SCENARIO_MODE = CTL_BIT(2),///< Super resolution mode targeted at video conference content - CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_ENABLE_CAMERA_SCENARIO_MODE = CTL_BIT(3),///< Super resolution mode targeted at camera capture content (e.g. - ///< security camera) - CTL_VIDEO_PROCESSING_SUPER_RESOLUTION_FLAG_MAX = 0x80000000 - -} ctl_video_processing_super_resolution_flag_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Super Resolution feature details structure to be used with -/// SUPER_RESOLUTION -typedef struct _ctl_video_processing_super_resolution_info_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_video_processing_super_resolution_flags_t super_resolution_flag;///< [in,out] SUPER_RESOLUTION flag - ctl_property_info_uint_t super_resolution_range_in_width; ///< [in,out] The range of input width information(min, max, default and - ///< step size)which super resolution is capable of supporting. - ctl_property_info_uint_t super_resolution_range_in_height; ///< [in,out] The range of input height information(min, max, default and - ///< step size)which super resolution is capable of supporting. - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_super_resolution_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Super Resolution Get/Set structure to be used with SUPER_RESOLUTION -typedef struct _ctl_video_processing_super_resolution_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_video_processing_super_resolution_flags_t super_resolution_flag;///< [in,out] SUPER_RESOLUTION flag - bool super_resolution_max_in_enabled; ///< [in,out] The enabling of maximum input width and height limition. If - ///< enabled, super resolution will always take effect if the input - ///< resolution is smaller than the below specified max resolution; - ///< otherwise, super_resolution_max_in_width and - ///< super_resolution_max_in_height will be ignored - uint32_t super_resolution_max_in_width; ///< [in,out] The maximum input width limition value setting which super - ///< resolution will be allowed to enabled. - uint32_t super_resolution_max_in_height; ///< [in,out] The maximum input height limiation value setting which super - ///< resolution will be allowed to enabled. - bool super_resolution_reboot_reset; ///< [in,out] Resetting of super resolution after rebooting. - uint32_t ReservedFields[15]; ///< [out] Reserved field of 60 bytes - char ReservedBytes[3]; ///< [out] Reserved field of 3 bytes - -} ctl_video_processing_super_resolution_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Noise Reduction feature details structure to be used with -/// NOISE_REDUCTION -typedef struct _ctl_video_processing_noise_reduction_info_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_property_info_uint_t noise_reduction; ///< [in,out] Noise reduction min, max, default and step size information - bool noise_reduction_auto_detect_supported; ///< [in,out] Noise reduction Auto Detect is supported; only valid if - ///< NOISE_REDUCTION is enabled. If enabled, noise reduction level is - ///< automatically determined and set value is not used. - ctl_property_info_boolean_t noise_reduction_auto_detect;///< [in,out] Noise reduction auto detect default information - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_noise_reduction_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Noise Reduction Get/Set structure to be used with NOISE_REDUCTION -typedef struct _ctl_video_processing_noise_reduction_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_property_uint_t noise_reduction; ///< [in,out] Noise reduction enable and value setting - ctl_property_boolean_t noise_reduction_auto_detect; ///< [in,out] Noise reduction auto detect setting - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_noise_reduction_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Adaptive Contrast Enhancement feature details structure to be used -/// with ADAPTIVE_CONTRAST_ENHANCEMENT -typedef struct _ctl_video_processing_adaptive_contrast_enhancement_info_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_property_info_uint_t adaptive_contrast_enhancement; ///< [in,out] Adaptive Contrast Enhancement min, max, default and step size - ///< information - bool adaptive_contrast_enhancement_coexistence_supported; ///< [in,out] Adaptive contrast enhancement coexistance is supported; only - ///< valid if ADAPTIVE_CONTRAST_ENHANCEMENT is enabled. If enabled, Video - ///< adaptive contrast ehancement will be allowed to be enabled and coexist - ///< with Display adaptive contrast ehancement feature. - ctl_property_info_boolean_t adaptive_contrast_enhancement_coexistence; ///< [in,out] Adaptive contrast enhancement coexistence default information - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_adaptive_contrast_enhancement_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Adaptive Contrast Enhancement Get/Set structure to be used with -/// ADAPTIVE_CONTRAST_ENHANCEMENT -typedef struct _ctl_video_processing_adaptive_contrast_enhancement_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_property_uint_t adaptive_contrast_enhancement; ///< [in,out] Adaptive Contrast Enhancement enable and value setting - ctl_property_boolean_t adaptive_contrast_enhancement_coexistence; ///< [in,out] Adaptive contrast enhancement coexistance setting - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_adaptive_contrast_enhancement_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Standard Color Correction feature details structure to be used with -/// STANDARD_COLOR_CORRECTION -typedef struct _ctl_video_processing_standard_color_correction_info_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool standard_color_correction_default_enable; ///< [in,out] STANDARD_COLOR_CORRECTION default enable setting. This - ///< global settings controls all of Hue, Saturation, Contrast, Brightness - ///< enabling. Individual Enable controls shall be ignored. - ctl_property_info_float_t brightness; ///< [in,out] Brightness min, max, default and step size information - ctl_property_info_float_t contrast; ///< [in,out] Contrast min, max, default and step size information - ctl_property_info_float_t hue; ///< [in,out] Hue min, max, default and step size information - ctl_property_info_float_t saturation; ///< [in,out] Saturation min, max, default and step size information - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_standard_color_correction_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Standard Color Correction Get/Set structure to be used with -/// STANDARD_COLOR_CORRECTION -typedef struct _ctl_video_processing_standard_color_correction_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool standard_color_correction_enable; ///< [in,out] STANDARD_COLOR_CORRECTION enable setting. This global - ///< setting controls all of Hue, Saturation, Contrast, Brightness - ///< enabling. - float brightness; ///< [in,out] Brightness value - float contrast; ///< [in,out] Contrast value - float hue; ///< [in,out] Hue value - float saturation; ///< [in,out] Saturation value - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_standard_color_correction_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Total Color Correction Get/Set structure to be used with -/// TOTAL_COLOR_CORRECTION -typedef struct _ctl_video_processing_total_color_correction_info_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool total_color_correction_default_enable; ///< [in,out] TOTAL_COLOR_CORRECTION enable setting. This global setting - ///< controls all of Red, Green, Blue, Yellow, Cyan, Magenta enabling. - ///< Individual Enable controls shall be ignored. - ctl_property_info_uint_t red; ///< [in,out] Red min, max, default and step size information - ctl_property_info_uint_t green; ///< [in,out] Green min, max, default and step size information - ctl_property_info_uint_t blue; ///< [in,out] Blue min, max, default and step size information - ctl_property_info_uint_t yellow; ///< [in,out] Yellow min, max, default and step size information - ctl_property_info_uint_t cyan; ///< [in,out] Cyan min, max, default and step size information - ctl_property_info_uint_t magenta; ///< [in,out] Magenta min, max, default and step size information - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_total_color_correction_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Total Color Correction Get/Set structure to be used with -/// TOTAL_COLOR_CORRECTION -typedef struct _ctl_video_processing_total_color_correction_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool total_color_correction_enable; ///< [in,out] TOTAL_COLOR_CORRECTION enable setting. This global setting - ///< controls all of Red, Green, Blue, Yellow, Cyan, Magenta enabling. - uint32_t red; ///< [in,out] Red value - uint32_t green; ///< [in,out] Green value - uint32_t blue; ///< [in,out] Blue value - uint32_t yellow; ///< [in,out] Yellow value - uint32_t cyan; ///< [in,out] Cyan value - uint32_t magenta; ///< [in,out] Magenta value - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_total_color_correction_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Video Processing feature details which will have range supported and -/// default values -typedef struct _ctl_video_processing_feature_details_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_video_processing_feature_t FeatureType; ///< [out] Video processing feature type - ctl_property_value_type_t ValueType; ///< [out] Type of value - ctl_property_info_t Value; ///< [out] Union of various type of values for Video Processing features. - ///< For enum types this can be noise reduction, color control etc. This - ///< member is valid iff ValueType is not CTL_PROPERTY_VALUE_TYPE_CUSTOM - int32_t CustomValueSize; ///< [in] CustomValue buffer size - void* pCustomValue; ///< [in,out] Pointer to a custom structure. Features that use CustomType, - ///< after the first query for all of the supported features the user needs - ///< to allocate this buffer and then query again just this specific - ///< feature for the structure to be filled in. Caller should allocate this - ///< buffer with known custom feature structure size. This member is valid - ///< iff ValueType is CTL_PROPERTY_VALUE_TYPE_CUSTOM. - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_feature_details_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Video Processing features which are controllable -typedef struct _ctl_video_processing_feature_caps_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t NumSupportedFeatures; ///< [in,out] Number of elements in supported features array - ctl_video_processing_feature_details_t* pFeatureDetails;///< [in,out] Array of supported features and their details - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_feature_caps_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Video Processing feature for get/set -typedef struct _ctl_video_processing_feature_getset_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_video_processing_feature_t FeatureType; ///< [in] Features interested in - char* ApplicationName; ///< [in] Application name for which the property type is applicable. If - ///< this is an empty string then this will get/set global settings for the - ///< given adapter. Note that this should contain only the name of the - ///< application and not the system specific path. [This is not currently - ///< supported and should be an empty string.] - int8_t ApplicationNameLength; ///< [in] Length of ApplicationName string - bool bSet; ///< [in] Set this if it's a set call - ctl_property_value_type_t ValueType; ///< [in] Type of value. Caller has to ensure it provides the right value - ///< type which decides how one read the union structure below - ctl_property_t Value; ///< [in,out] Union of various type of values for Video Processing - ///< features. For enum types this can be noise reduction, color control - ///< etc. This member is valid iff ValueType is not - ///< CTL_PROPERTY_VALUE_TYPE_CUSTOM - int32_t CustomValueSize; ///< [in] CustomValue buffer size. For a feature requiring custom struct, - ///< caller will know of it upfront the struct to use based on the feautre - ///< and can provide the right size info here - void* pCustomValue; ///< [in,out] Pointer to a custom structure. Caller should allocate this - ///< buffer with known custom feature structure size. This member is valid - ///< iff ValueType is CTL_PROPERTY_VALUE_TYPE_CUSTOM - uint32_t ReservedFields[16]; ///< [out] Reserved field of 64 bytes - -} ctl_video_processing_feature_getset_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Video Processing capabilities -/// -/// @details -/// - The application gets Video Processing properties -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pFeatureCaps` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSupportedVideoProcessingCapabilities( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_video_processing_feature_caps_t* pFeatureCaps ///< [in,out][release] Video Processing properties - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get/Set Video Processing feature details -/// -/// @details -/// - Video Processing feature details -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pFeature` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetSetVideoProcessingFeature( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_video_processing_feature_getset_t* pFeature ///< [in][release] Video Processing feature get/set parameter - ); - - -#if !defined(__GNUC__) -#pragma endregion // media -#endif -// Intel 'ctlApi' for Device Adapter - Memory management -#if !defined(__GNUC__) -#pragma region memory -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory module types -typedef enum _ctl_mem_type_t -{ - CTL_MEM_TYPE_HBM = 0, ///< HBM memory - CTL_MEM_TYPE_DDR = 1, ///< DDR memory - CTL_MEM_TYPE_DDR3 = 2, ///< DDR3 memory - CTL_MEM_TYPE_DDR4 = 3, ///< DDR4 memory - CTL_MEM_TYPE_DDR5 = 4, ///< DDR5 memory - CTL_MEM_TYPE_LPDDR = 5, ///< LPDDR memory - CTL_MEM_TYPE_LPDDR3 = 6, ///< LPDDR3 memory - CTL_MEM_TYPE_LPDDR4 = 7, ///< LPDDR4 memory - CTL_MEM_TYPE_LPDDR5 = 8, ///< LPDDR5 memory - CTL_MEM_TYPE_GDDR4 = 9, ///< GDDR4 memory - CTL_MEM_TYPE_GDDR5 = 10, ///< GDDR5 memory - CTL_MEM_TYPE_GDDR5X = 11, ///< GDDR5X memory - CTL_MEM_TYPE_GDDR6 = 12, ///< GDDR6 memory - CTL_MEM_TYPE_GDDR6X = 13, ///< GDDR6X memory - CTL_MEM_TYPE_GDDR7 = 14, ///< GDDR7 memory - CTL_MEM_TYPE_UNKNOWN = 15, ///< UNKNOWN memory - CTL_MEM_TYPE_MAX - -} ctl_mem_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory module location -typedef enum _ctl_mem_loc_t -{ - CTL_MEM_LOC_SYSTEM = 0, ///< System memory - CTL_MEM_LOC_DEVICE = 1, ///< On board local device memory - CTL_MEM_LOC_MAX - -} ctl_mem_loc_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory properties -typedef struct _ctl_mem_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_mem_type_t type; ///< [out] The memory type - ctl_mem_loc_t location; ///< [out] Location of this memory (system, device) - uint64_t physicalSize; ///< [out] Physical memory size in bytes. A value of 0 indicates that this - ///< property is not known. However, a call to ::ctlMemoryGetState() will - ///< correctly return the total size of usable memory. - int32_t busWidth; ///< [out] Width of the memory bus. A value of -1 means that this property - ///< is unknown. - int32_t numChannels; ///< [out] The number of memory channels. A value of -1 means that this - ///< property is unknown. - -} ctl_mem_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory state - health, allocated -/// -/// @details -/// - Percent allocation is given by 100 * (size - free / size. -/// - Percent free is given by 100 * free / size. -typedef struct _ctl_mem_state_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint64_t free; ///< [out] The free memory in bytes - uint64_t size; ///< [out] The total allocatable memory in bytes (can be less than - ///< ::ctl_mem_properties_t.physicalSize) - -} ctl_mem_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Memory bandwidth -/// -/// @details -/// - Percent bandwidth is calculated by taking two snapshots (s1, s2) and -/// using the equation: %bw = 10^6 * ((s2.readCounter - s1.readCounter) + -/// (s2.writeCounter - s1.writeCounter)) / (s2.maxBandwidth * -/// (s2.timestamp - s1.timestamp)) -typedef struct _ctl_mem_bandwidth_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint64_t maxBandwidth; ///< [out] Current maximum bandwidth in units of bytes/sec - uint64_t timestamp; ///< [out] The timestamp (in microseconds) when these measurements were sampled. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - uint64_t readCounter; ///< [out] Total bytes read from memory. Supported only for Version > 0 - uint64_t writeCounter; ///< [out] Total bytes written to memory. Supported only for Version > 0 - -} ctl_mem_bandwidth_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of memory modules -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumMemoryModules( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get memory properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMemory` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlMemoryGetProperties( - ctl_mem_handle_t hMemory, ///< [in] Handle for the component. - ctl_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get memory state - health, allocated -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMemory` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlMemoryGetState( - ctl_mem_handle_t hMemory, ///< [in] Handle for the component. - ctl_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get memory bandwidth -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMemory` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pBandwidth` -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to query this telemetry. -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlMemoryGetBandwidth( - ctl_mem_handle_t hMemory, ///< [in] Handle for the component. - ctl_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the current health, free memory, total memory - ///< size. - ); - - -#if !defined(__GNUC__) -#pragma endregion // memory -#endif -// Intel 'ctlApi' for Device Adapter - Overclock -#if !defined(__GNUC__) -#pragma region overclock -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Telemetry Item for each telemetry property -/// -/// @details -/// - If the supported field is true, then the entire structure has valid -/// information. -/// - The ::ctl_data_value_t is of type ::ctl_data_type_t and units -/// ::ctl_units_t -typedef struct _ctl_oc_telemetry_item_t -{ - bool bSupported; ///< [out] Indicates if the value is supported. - ctl_units_t units; ///< [out] Indicates the units of the value. - ctl_data_type_t type; ///< [out] Indicates the data type. - ctl_data_value_t value; ///< [out] The value of type ::ctl_data_type_t and units ::ctl_units_t. - -} ctl_oc_telemetry_item_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Overclocking Control Information -/// -/// @details -/// - Whether the device supports overclocking. -/// - The -/// bSupported/bRelative/bReference/units/min/max/step/default/reference -/// values for the available overclock controls -/// - The idea is to facilitate the way the applications present overclock -/// settings to the user. If bSupported is false, the corresponding -/// overclock control is not supported -/// - The setting units will be an enum that enables the application to know -/// the units for the control setting e.g. MHz. The min and max settings -/// give the limits for the control. -/// - The step setting gives the minimum change in the control value (plus -/// or minus) - if a control is not changed by at least this amount, the -/// hardware may round up or down. -/// - The default values gives the manufacturing setting for the control. -/// Some controls such as frequency offset and voltage offset are -/// relative; in this case, bRelative will be true, otherwise the control -/// settings are absolute values. -/// - For relative controls and if bReference is true, the reference value -/// gives the absolute value at the default setting. -/// - If bReference is false, the absolute value of the default setting is -/// no not known and it is probably better to display the setting to users -/// as percentage offsets. -typedef struct _ctl_oc_control_info_t -{ - bool bSupported; ///< [out] Indicates if the values are known. - bool bRelative; ///< [out] Indicates if the values are meant to be taken as relative values - ///< instead of absolut values. - bool bReference; ///< [out] For relative values, this indicates if a reference is available. - ctl_units_t units; ///< [out] Units for the values. - double min; ///< [out] Minimum Value. - double max; ///< [out] Maximum Value. - double step; ///< [out] Step Value. - double Default; ///< [out] Default Value. - double reference; ///< [out] Reference Value if the bReference is true. - -} ctl_oc_control_info_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Overclock properties -typedef struct _ctl_oc_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool bSupported; ///< [out] Indicates if the adapter supports overclocking. - ctl_oc_control_info_t gpuFrequencyOffset; ///< [out] related to function ::ctlOverclockGpuFrequencyOffsetSet - ctl_oc_control_info_t gpuVoltageOffset; ///< [out] related to function ::ctlOverclockGpuVoltageOffsetSet - ctl_oc_control_info_t vramFrequencyOffset; ///< [out] Property Field Deprecated / No Longer Supported - ctl_oc_control_info_t vramVoltageOffset; ///< [out] Property Field Deprecated / No Longer Supported - ctl_oc_control_info_t powerLimit; ///< [out] related to function ::ctlOverclockPowerLimitSet - ctl_oc_control_info_t temperatureLimit; ///< [out] related to function ::ctlOverclockTemperatureLimitSet - -} ctl_oc_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Overclock Voltage Frequency Pair -typedef struct _ctl_oc_vf_pair_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - double Voltage; ///< [in,out] Voltage component of the pair in mV. - double Frequency; ///< [in,out] Frequency component of the pair in MHz. - -} ctl_oc_vf_pair_t; - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_PSU_COUNT -/// @brief Maximum number power supply units. -#define CTL_PSU_COUNT 5 -#endif // CTL_PSU_COUNT - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PSU Type. -typedef enum _ctl_psu_type_t -{ - CTL_PSU_TYPE_PSU_NONE = 0, ///< Type of the PSU is unknown. - CTL_PSU_TYPE_PSU_PCIE = 1, ///< Type of the PSU is PCIe - CTL_PSU_TYPE_PSU_6PIN = 2, ///< Type of the PSU is 6 PIN - CTL_PSU_TYPE_PSU_8PIN = 3, ///< Type of the PSU is 8 PIN - CTL_PSU_TYPE_MAX - -} ctl_psu_type_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PSU Info -typedef struct _ctl_psu_info_t -{ - bool bSupported; ///< [out] Indicates if this PSU entry is supported. - ctl_psu_type_t psuType; ///< [out] Type of the PSU. - ctl_oc_telemetry_item_t energyCounter; ///< [out] Snapshot of the monotonic energy counter maintained by hardware. - ///< It measures the total energy consumed this power source. By taking the - ///< delta between two snapshots and dividing by the delta time in seconds, - ///< an application can compute the average power. - ctl_oc_telemetry_item_t voltage; ///< [out] Instantaneous snapshot of the voltage of this power source. - -} ctl_psu_info_t; - -/////////////////////////////////////////////////////////////////////////////// -#ifndef CTL_FAN_COUNT -/// @brief Maximum number of Fans -#define CTL_FAN_COUNT 5 -#endif // CTL_FAN_COUNT - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Power Telemetry -typedef struct _ctl_power_telemetry_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_oc_telemetry_item_t timeStamp; ///< [out] Snapshot of the timestamp counter that measures the total time - ///< since Jan 1, 1970 UTC. It is a decimal value in seconds with a minimum - ///< accuracy of 1 millisecond. - ctl_oc_telemetry_item_t gpuEnergyCounter; ///< [out] Snapshot of the monotonic energy counter maintained by hardware. - ///< It measures the total energy consumed by the GPU chip. By taking the - ///< delta between two snapshots and dividing by the delta time in seconds, - ///< an application can compute the average power. - ctl_oc_telemetry_item_t gpuVoltage; ///< [out] Instantaneous snapshot of the voltage feeding the GPU chip. It - ///< is measured at the power supply output - chip input will be lower. - ctl_oc_telemetry_item_t gpuCurrentClockFrequency; ///< [out] Instantaneous snapshot of the GPU chip frequency. - ctl_oc_telemetry_item_t gpuCurrentTemperature; ///< [out] Instantaneous snapshot of the GPU chip temperature, read from - ///< the sensor reporting the highest value. - ctl_oc_telemetry_item_t globalActivityCounter; ///< [out] Snapshot of the monotonic global activity counter. It measures - ///< the time in seconds (accurate down to 1 millisecond) that any GPU - ///< engine is busy. By taking the delta between two snapshots and dividing - ///< by the delta time in seconds, an application can compute the average - ///< percentage utilization of the GPU.. - ctl_oc_telemetry_item_t renderComputeActivityCounter; ///< [out] Snapshot of the monotonic 3D/compute activity counter. It - ///< measures the time in seconds (accurate down to 1 millisecond) that any - ///< 3D render/compute engine is busy. By taking the delta between two - ///< snapshots and dividing by the delta time in seconds, an application - ///< can compute the average percentage utilization of all 3D - ///< render/compute blocks in the GPU. - ctl_oc_telemetry_item_t mediaActivityCounter; ///< [out] Snapshot of the monotonic media activity counter. It measures - ///< the time in seconds (accurate down to 1 millisecond) that any media - ///< engine is busy. By taking the delta between two snapshots and dividing - ///< by the delta time in seconds, an application can compute the average - ///< percentage utilization of all media blocks in the GPU. - bool gpuPowerLimited; ///< [out] Instantaneous indication that the desired GPU frequency is being - ///< throttled because the GPU chip is exceeding the maximum power limits. - ///< Increasing the power limits using ::ctlOverclockPowerLimitSet() is one - ///< way to remove this limitation. - bool gpuTemperatureLimited; ///< [out] Instantaneous indication that the desired GPU frequency is being - ///< throttled because the GPU chip is exceeding the temperature limits. - ///< Increasing the temperature limits using - ///< ::ctlOverclockTemperatureLimitSet() is one way to reduce this - ///< limitation. Improving the cooling solution is another way. - bool gpuCurrentLimited; ///< [out] Instantaneous indication that the desired GPU frequency is being - ///< throttled because the GPU chip has exceeded the power supply current - ///< limits. A better power supply is required to reduce this limitation. - bool gpuVoltageLimited; ///< [out] Instantaneous indication that the GPU frequency cannot be - ///< increased because the voltage limits have been reached. Increase the - ///< voltage offset using ::ctlOverclockGpuVoltageOffsetSet() is one way to - ///< reduce this limitation. - bool gpuUtilizationLimited; ///< [out] Instantaneous indication that due to lower GPU utilization, the - ///< hardware has lowered the GPU frequency. - ctl_oc_telemetry_item_t vramEnergyCounter; ///< [out] Snapshot of the monotonic energy counter maintained by hardware. - ///< It measures the total energy consumed by the local memory modules. By - ///< taking the delta between two snapshots and dividing by the delta time - ///< in seconds, an application can compute the average power. - ctl_oc_telemetry_item_t vramVoltage; ///< [out] Instantaneous snapshot of the voltage feeding the memory - ///< modules. - ctl_oc_telemetry_item_t vramCurrentClockFrequency; ///< [out] Instantaneous snapshot of the raw clock frequency driving the - ///< memory modules. - ctl_oc_telemetry_item_t vramCurrentEffectiveFrequency; ///< [out] Instantaneous snapshot of the effective data transfer rate that - ///< the memory modules can sustain based on the current clock frequency.. - ctl_oc_telemetry_item_t vramReadBandwidthCounter; ///< [out] Instantaneous snapshot of the monotonic counter that measures - ///< the read traffic from the memory modules. By taking the delta between - ///< two snapshots and dividing by the delta time in seconds, an - ///< application can compute the average read bandwidth. - ctl_oc_telemetry_item_t vramWriteBandwidthCounter; ///< [out] Instantaneous snapshot of the monotonic counter that measures - ///< the write traffic to the memory modules. By taking the delta between - ///< two snapshots and dividing by the delta time in seconds, an - ///< application can compute the average write bandwidth. - ctl_oc_telemetry_item_t vramCurrentTemperature; ///< [out] Instantaneous snapshot of the GPU chip temperature, read from - ///< the sensor reporting the highest value. - bool vramPowerLimited; ///< [out] Instantaneous indication that the memory frequency is being - ///< throttled because the memory modules are exceeding the maximum power - ///< limits. - bool vramTemperatureLimited; ///< [out] Instantaneous indication that the memory frequency is being - ///< throttled because the memory modules are exceeding the temperature - ///< limits. - bool vramCurrentLimited; ///< [out] Instantaneous indication that the memory frequency is being - ///< throttled because the memory modules have exceeded the power supply - ///< current limits. - bool vramVoltageLimited; ///< [out] Instantaneous indication that the memory frequency cannot be - ///< increased because the voltage limits have been reached. - bool vramUtilizationLimited; ///< [out] Instantaneous indication that due to lower memory traffic, the - ///< hardware has lowered the memory frequency. - ctl_oc_telemetry_item_t totalCardEnergyCounter; ///< [out] Total Card Energy Counter. - ctl_psu_info_t psu[CTL_PSU_COUNT]; ///< [out] PSU voltage and power. - ctl_oc_telemetry_item_t fanSpeed[CTL_FAN_COUNT];///< [out] Fan speed. - -} ctl_power_telemetry_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get overclock properties - available properties. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pOcProperties` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockGetProperties( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - ctl_oc_properties_t* pOcProperties ///< [in,out] The overclocking properties for the specified domain. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Overclock Waiver - Warranty Waiver. -/// -/// @details -/// - Most of the overclock functions will return an error if the waiver is -/// not set. This is because most overclock settings will increase the -/// electric/thermal stress on the part and thus reduce its lifetime. -/// - By setting the waiver, the user is indicate that they are accepting a -/// reduction in the lifetime of the part. -/// - It is the responsibility of overclock applications to notify each user -/// at least once with a popup of the dangers and requiring acceptance. -/// - Only once the user has accepted should this function be called by the -/// application. -/// - It is acceptable for the application to cache the user choice and call -/// this function on future executions without issuing the popup. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockWaiverSet( - ctl_device_adapter_handle_t hDeviceHandle ///< [in][release] Handle to display adapter - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the Overclock Frequency Offset for the GPU in MHz. -/// -/// @details -/// - Determine the current frequency offset in effect (refer to -/// ::ctlOverclockGpuFrequencyOffsetSet() for details). -/// - The value returned may be different from the value that was previously -/// set by the application depending on hardware limitations or if the -/// function ::ctlOverclockGpuFrequencyOffsetSet() has been called or -/// another application that has changed the value. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pOcFrequencyOffset` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockGpuFrequencyOffsetGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pOcFrequencyOffset ///< [in,out] The Turbo Overclocking Frequency Desired in MHz. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the Overclock Frequency Offset for the GPU in MHZ. -/// -/// @details -/// - The purpose of this function is to increase/decrease the frequency at -/// which typical workloads will run within the same thermal budget. -/// - The frequency offset is expressed in units of ±1MHz. -/// - The actual operating frequency for each workload is not guaranteed to -/// change exactly by the specified offset. -/// - For positive frequency offsets, the factory maximum frequency may -/// increase by up to the specified amount. -/// - For negative frequency offsets, the overclock waiver must have been -/// set since this can result in running the part at voltages beyond the -/// part warrantee limits. An error is returned if the waiver has not been -/// set. -/// - Specifying large values for the frequency offset can lead to -/// instability. It is recommended that changes are made in small -/// increments and stability/performance measured running intense GPU -/// workloads before increasing further. -/// - This setting is not persistent through system reboots or driver -/// resets/hangs. It is up to the overclock application to reapply the -/// settings in those cases. -/// - This setting can cause system/device instability. It is up to the -/// overclock application to detect if the system has rebooted -/// unexpectedly or the device was restarted. When this occurs, the -/// application should not reapply the overclock settings automatically -/// but instead return to previously known good settings or notify the -/// user that the settings are not being applied. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockGpuFrequencyOffsetSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double ocFrequencyOffset ///< [in] The Turbo Overclocking Frequency Desired in MHz. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the Overclock Gpu Voltage Offset in mV. -/// -/// @details -/// - Determine the current voltage offset in effect on the hardware (refer -/// to ::ctlOverclockGpuVoltageOffsetSet for details). -/// - The value returned may be different from the value that was previously -/// set by the application depending on hardware limitations or if the -/// function ::ctlOverclockGpuVoltageOffsetSet has been called or another -/// application that has changed the value. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pOcVoltageOffset` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockGpuVoltageOffsetGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pOcVoltageOffset ///< [in,out] The Turbo Overclocking Frequency Desired in mV. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the Overclock Gpu Voltage Offset in mV. -/// -/// @details -/// - The purpose of this function is to attempt to run the GPU up to higher -/// voltages beyond the part warrantee limits. This can permit running at -/// even higher frequencies than can be obtained using the frequency -/// offset setting, but at the risk of reducing the lifetime of the part. -/// - The voltage offset is expressed in units of ±millivolts with values -/// permitted down to a resolution of 1 millivolt. -/// - The overclock waiver must be set before calling this function -/// otherwise and error will be returned. -/// - There is no guarantee that a workload can operate at the higher -/// frequencies permitted by this setting. Significantly more heat will be -/// generated at these high frequencies/voltages which will necessitate a -/// good cooling solution. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockGpuVoltageOffsetSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double ocVoltageOffset ///< [in] The Turbo Overclocking Frequency Desired in mV. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Gets the Locked GPU Voltage for Overclocking in mV. -/// -/// @details -/// - The purpose of this function is to determine if the current values of -/// the frequency/voltage lock. -/// - If the lock is not currently active, will return 0 for frequency and -/// voltage. -/// - Note that the operating frequency/voltage may be lower than these -/// settings if power/thermal limits are exceeded. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pVfPair` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockGpuLockGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - ctl_oc_vf_pair_t* pVfPair ///< [out] The current locked voltage and frequency. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Locks the GPU voltage for Overclocking in mV. -/// -/// @details -/// - The purpose of this function is to provide an interface for scanners -/// to lock the frequency and voltage to fixed values. -/// - The frequency is expressed in units of MHz with a resolution of 1MHz. -/// - The voltage is expressed in units of ±millivolts with values -/// permitted down to a resolution of 1 millivolt. -/// - The overclock waiver must be set since fixing the voltage at a high -/// value puts unnecessary stress on the part. -/// - The actual frequency may reduce depending on power/thermal -/// limitations. -/// - Requesting a frequency and/or voltage of 0 will return the hardware to -/// dynamic frequency/voltage management with any previous frequency -/// offset or voltage offset settings reapplied. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockGpuLockSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - ctl_oc_vf_pair_t vFPair ///< [in] The current locked voltage and frequency. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the current Vram Frequency Offset in GT/s. -/// -/// @details -/// - The purpose of this function is to return the current VRAM frequency -/// offset in units of GT/s. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pOcFrequencyOffset` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockVramFrequencyOffsetGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pOcFrequencyOffset ///< [in,out] The current Memory Frequency in GT/s. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the desired Vram frquency Offset in GT/s -/// -/// @details -/// - The purpose of this function is to increase/decrease the frequency of -/// VRAM. -/// - The frequency offset is expressed in units of GT/s with a minimum step -/// size given by ::ctlOverclockGetProperties. -/// - The actual operating frequency for each workload is not guaranteed to -/// change exactly by the specified offset. -/// - The waiver must be set using clibOverclockWaiverSet() before this -/// function can be called. -/// - This setting is not persistent through system reboots or driver -/// resets/hangs. It is up to the overclock application to reapply the -/// settings in those cases. -/// - This setting can cause system/device instability. It is up to the -/// overclock application to detect if the system has rebooted -/// unexpectedly or the device was restarted. When this occurs, the -/// application should not reapply the overclock settings automatically -/// but instead return to previously known good settings or notify the -/// user that the settings are not being applied. -/// - If the memory controller doesn't support changes to frequency on the -/// fly, one of the following return codes will be given: -/// - ::CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory -/// overclock will be applied when the device is reset or the system is -/// rebooted. In this case, the overclock software should check if the -/// overclock request was applied after the reset/reboot. If it was and -/// when the overclock application shuts down gracefully and if the -/// overclock application wants the setting to be persistent, the -/// application should request the same overclock settings again so that -/// they will be applied on the next reset/reboot. If this is not done, -/// then every time the device is reset and overclock is requested, the -/// device needs to be reset a second time. -/// - ::CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory -/// overclock will be applied when the system is rebooted. In this case, -/// the overclock software should check if the overclock request was -/// applied after the reboot. If it was and when the overclock application -/// shuts down gracefully and if the overclock application wants the -/// setting to be persistent, the application should request the same -/// overclock settings again so that they will be applied on the next -/// reset/reboot. If this is not done and the overclock setting is -/// requested after the reboot has occurred, a second reboot will be -/// required. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockVramFrequencyOffsetSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double ocFrequencyOffset ///< [in] The desired Memory Frequency in GT/s. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the Overclock Vram Voltage Offset in mV. -/// -/// @details -/// - The purpose of this function is to increase/decrease the voltage of -/// VRAM. -/// - The voltage offset is expressed in units of millivolts with a minimum -/// step size given by ::ctlOverclockGetProperties. -/// - The waiver must be set using ::ctlOverclockWaiverSet before this -/// function can be called. -/// - This setting is not persistent through system reboots or driver -/// resets/hangs. It is up to the overclock application to reapply the -/// settings in those cases. -/// - This setting can cause system/device instability. It is up to the -/// overclock application to detect if the system has rebooted -/// unexpectedly or the device was restarted. When this occurs, the -/// application should not reapply the overclock settings automatically -/// but instead return to previously known good settings or notify the -/// user that the settings are not being applied. -/// - If the memory controller doesn't support changes to voltage on the -/// fly, one of the following return codes will be given: -/// - ::CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory -/// overclock will be applied when the device is reset or the system is -/// rebooted. In this case, the overclock software should check if the -/// overclock request was applied after the reset/reboot. If it was and -/// when the overclock application shuts down gracefully and if the -/// overclock application wants the setting to be persistent, the -/// application should request the same overclock settings again so that -/// they will be applied on the next reset/reboot. If this is not done, -/// then every time the device is reset and overclock is requested, the -/// device needs to be reset a second time. -/// - ::CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory -/// overclock will be applied when the system is rebooted. In this case, -/// the overclock software should check if the overclock request was -/// applied after the reboot. If it was and when the overclock application -/// shuts down gracefully and if the overclock application wants the -/// setting to be persistent, the application should request the same -/// overclock settings again so that they will be applied on the next -/// reset/reboot. If this is not done and the overclock setting is -/// requested after the reboot has occurred, a second reboot will be -/// required. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pVoltage` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockVramVoltageOffsetGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pVoltage ///< [out] The current locked voltage in mV. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the Overclock Vram Voltage Offset in mV. -/// -/// @details -/// - The purpose of this function is to set the maximum sustained power -/// limit. If the average GPU power averaged over a few seconds exceeds -/// this value, the frequency of the GPU will be throttled. -/// - Set a value of 0 to disable this power limit. In this case, the GPU -/// frequency will not throttle due to average power but may hit other -/// limits. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockVramVoltageOffsetSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double voltage ///< [in] The voltage to be locked in mV. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the sustained power limit in mW. -/// -/// @details -/// - The purpose of this function is to read the current sustained power -/// limit. -/// - A value of 0 means that the limit is disabled - the GPU frequency can -/// run as high as possible until other limits are hit. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pSustainedPowerLimit` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockPowerLimitGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pSustainedPowerLimit ///< [in,out] The current sustained power limit in mW. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the sustained power limit in mW. -/// -/// @details -/// - The purpose of this function is to set the maximum sustained power -/// limit. If the average GPU power averaged over a few seconds exceeds -/// this value, the frequency of the GPU will be throttled. -/// - Set a value of 0 to disable this power limit. In this case, the GPU -/// frequency will not throttle due to average power but may hit other -/// limits. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockPowerLimitSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double sustainedPowerLimit ///< [in] The desired sustained power limit in mW. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the current temperature limit in Celsius. -/// -/// @details -/// - The purpose of this function is to read the current thermal limit. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pTemperatureLimit` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockTemperatureLimitGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pTemperatureLimit ///< [in,out] The current temperature limit in Celsius. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set the temperature limit in Celsius. -/// -/// @details -/// - The purpose of this function is to change the maximum thermal limit. -/// When the GPU temperature exceeds this value, the GPU frequency will be -/// throttled. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockTemperatureLimitSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double temperatureLimit ///< [in] The desired temperature limit in Celsius. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Power Telemetry. -/// -/// @details -/// - Limited rate of 50 ms, any call under 50 ms will return the same -/// information. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pTelemetryInfo` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPowerTelemetryGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - ctl_power_telemetry_t* pTelemetryInfo ///< [out] The overclocking properties for the specified domain. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Reset all Overclock Settings to stock -/// -/// @details -/// - Reset all Overclock setting to default using single API call -/// - This request resets any changes made to GpuFrequencyOffset, -/// GpuVoltageOffset, PowerLimit, TemperatureLimit, GpuLock -/// - This Doesn't reset any Fan Curve Changes. It can be reset using -/// ctlFanSetDefaultMode -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDeviceHandle` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlOverclockResetToDefault( - ctl_device_adapter_handle_t hDeviceHandle ///< [in][release] Handle to display adapter - ); - - -#if !defined(__GNUC__) -#pragma endregion // overclock -#endif -// Intel 'ctlApi' for Device Adapter - PCI Information -#if !defined(__GNUC__) -#pragma region pci -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief PCI address -typedef struct _ctl_pci_address_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint32_t domain; ///< [out] BDF domain - uint32_t bus; ///< [out] BDF bus - uint32_t device; ///< [out] BDF device - uint32_t function; ///< [out] BDF function - -} ctl_pci_address_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief PCI speed -typedef struct _ctl_pci_speed_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - int32_t gen; ///< [out] The link generation. A value of -1 means that this property is - ///< unknown. - int32_t width; ///< [out] The number of lanes. A value of -1 means that this property is - ///< unknown. - int64_t maxBandwidth; ///< [out] The maximum bandwidth in bytes/sec (sum of all lanes). A value - ///< of -1 means that this property is unknown. - -} ctl_pci_speed_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Static PCI properties -typedef struct _ctl_pci_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_pci_address_t address; ///< [out] The BDF address - ctl_pci_speed_t maxSpeed; ///< [out] Fastest port configuration supported by the device (sum of all - ///< lanes) - bool resizable_bar_supported; ///< [out] Support for Resizable Bar on this device. - bool resizable_bar_enabled; ///< [out] Resizable Bar enabled on this device - -} ctl_pci_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Dynamic PCI state -typedef struct _ctl_pci_state_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_pci_speed_t speed; ///< [out] The current port configure speed - -} ctl_pci_state_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get PCI properties - address, max speed -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPciGetProperties( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get current PCI state - current speed -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pState` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPciGetState( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_pci_state_t* pState ///< [in,out] Will contain the PCI properties. - ); - - -#if !defined(__GNUC__) -#pragma endregion // pci -#endif -// Intel 'ctlApi' for Device Adapter - Power management -#if !defined(__GNUC__) -#pragma region power -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Properties related to device power settings -typedef struct _ctl_power_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool canControl; ///< [out] Software can change the power limits of this domain assuming the - ///< user has permissions. - int32_t defaultLimit; ///< [out] The factory default TDP power limit of the part in milliwatts. A - ///< value of -1 means that this is not known. - int32_t minLimit; ///< [out] The minimum power limit in milliwatts that can be requested. - int32_t maxLimit; ///< [out] The maximum power limit in milliwatts that can be requested. - -} ctl_power_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Energy counter snapshot -/// -/// @details -/// - Average power is calculated by taking two snapshots (s1, s2) and using -/// the equation: PowerWatts = (s2.energy - s1.energy) / (s2.timestamp - -/// s1.timestamp) -typedef struct _ctl_power_energy_counter_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint64_t energy; ///< [out] The monotonic energy counter in microjoules. - uint64_t timestamp; ///< [out] Microsecond timestamp when energy was captured. - ///< This timestamp should only be used to calculate delta time between - ///< snapshots of this structure. - ///< Never take the delta of this timestamp with the timestamp from a - ///< different structure since they are not guaranteed to have the same base. - ///< The absolute value of the timestamp is only valid during within the - ///< application and may be different on the next execution. - -} ctl_power_energy_counter_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Sustained power limits -/// -/// @details -/// - The power controller (Punit) will throttle the operating frequency if -/// the power averaged over a window (typically seconds) exceeds this -/// limit. -typedef struct _ctl_power_sustained_limit_t -{ - bool enabled; ///< [in,out] indicates if the limit is enabled (true) or ignored (false) - int32_t power; ///< [in,out] power limit in milliwatts - int32_t interval; ///< [in,out] power averaging window (Tau) in milliseconds - -} ctl_power_sustained_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Burst power limit -/// -/// @details -/// - The power controller (Punit) will throttle the operating frequency of -/// the device if the power averaged over a few milliseconds exceeds a -/// limit known as PL2. Typically PL2 > PL1 so that it permits the -/// frequency to burst higher for short periods than would be otherwise -/// permitted by PL1. -typedef struct _ctl_power_burst_limit_t -{ - bool enabled; ///< [in,out] indicates if the limit is enabled (true) or ignored (false) - int32_t power; ///< [in,out] power limit in milliwatts - -} ctl_power_burst_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Peak power limit -/// -/// @details -/// - The power controller (Punit) will preemptively throttle the operating -/// frequency of the device when the instantaneous power exceeds this -/// limit. The limit is known as PL4. It expresses the maximum power that -/// can be drawn from the power supply. -/// - If this power limit is removed or set too high, the power supply will -/// generate an interrupt when it detects an overcurrent condition and the -/// power controller will throttle the device frequencies down to min. It -/// is thus better to tune the PL4 value in order to avoid such -/// excursions. -typedef struct _ctl_power_peak_limit_t -{ - int32_t powerAC; ///< [in,out] power limit in milliwatts for the AC power source. - int32_t powerDC; ///< [in,out] power limit in milliwatts for the DC power source. On input, - ///< this is ignored if the product does not have a battery. On output, - ///< this will be -1 if the product does not have a battery. - -} ctl_power_peak_limit_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Power limits -typedef struct _ctl_power_limits_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_power_sustained_limit_t sustainedPowerLimit;///< [in,out] sustained power limit. - ctl_power_burst_limit_t burstPowerLimit; ///< [in,out] burst power limit. - ctl_power_peak_limit_t peakPowerLimits; ///< [in,out] peak power limit. - -} ctl_power_limits_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Energy threshold -/// -/// @details -/// - . -typedef struct _ctl_energy_threshold_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - bool enable; ///< [in,out] Indicates if the energy threshold is enabled. - double threshold; ///< [in,out] The energy threshold in Joules. Will be 0.0 if no threshold - ///< has been set. - uint32_t processId; ///< [in,out] The host process ID that set the energy threshold. Will be - ///< 0xFFFFFFFF if no threshold has been set. - -} ctl_energy_threshold_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of power domains -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumPowerDomains( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get properties related to a power domain -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPowerGetProperties( - ctl_pwr_handle_t hPower, ///< [in] Handle for the component. - ctl_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get energy counter -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pEnergy` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPowerGetEnergyCounter( - ctl_pwr_handle_t hPower, ///< [in] Handle for the component. - ctl_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and - ///< timestamp when the last counter value was measured. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get power limits -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPowerGetLimits( - ctl_pwr_handle_t hPower, ///< [in] Handle for the component. - ctl_power_limits_t* pPowerLimits ///< [in,out][optional] Structure that will contain the power limits. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Set power limits -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hPower` -/// - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -/// + User does not have permissions to make these modifications. -/// - ::CTL_RESULT_ERROR_NOT_AVAILABLE -/// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlPowerSetLimits( - ctl_pwr_handle_t hPower, ///< [in] Handle for the component. - const ctl_power_limits_t* pPowerLimits ///< [in][optional] Structure that will contain the power limits. - ); - - -#if !defined(__GNUC__) -#pragma endregion // power -#endif -// Intel 'ctlApi' for Device Adapter - Temperature Sensors -#if !defined(__GNUC__) -#pragma region temperature -#endif -/////////////////////////////////////////////////////////////////////////////// -/// @brief Temperature sensors -typedef enum _ctl_temp_sensors_t -{ - CTL_TEMP_SENSORS_GLOBAL = 0, ///< The maximum temperature across all device sensors - CTL_TEMP_SENSORS_GPU = 1, ///< The maximum temperature across all sensors in the GPU - CTL_TEMP_SENSORS_MEMORY = 2, ///< The maximum temperature across all sensors in the local memory - CTL_TEMP_SENSORS_GLOBAL_MIN = 3, ///< The minimum temperature across all device sensors - CTL_TEMP_SENSORS_GPU_MIN = 4, ///< The minimum temperature across all sensors in the GPU - CTL_TEMP_SENSORS_MEMORY_MIN = 5, ///< The minimum temperature across all sensors in the local device memory - CTL_TEMP_SENSORS_MAX - -} ctl_temp_sensors_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Temperature sensor properties -typedef struct _ctl_temp_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - ctl_temp_sensors_t type; ///< [out] Which part of the device the temperature sensor measures - double maxTemperature; ///< [out] Will contain the maximum temperature for the specific device in - ///< degrees Celsius. - -} ctl_temp_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get handle of temperature sensors -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hDAhandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumTemperatureSensors( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get temperature sensor properties -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hTemperature` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pProperties` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlTemperatureGetProperties( - ctl_temp_handle_t hTemperature, ///< [in] Handle for the component. - ctl_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get the temperature from a specified sensor -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - The implementation of this function should be lock-free. -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hTemperature` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pTemperature` -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlTemperatureGetState( - ctl_temp_handle_t hTemperature, ///< [in] Handle for the component. - double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor - ///< in degrees Celsius. - ); - - -#if !defined(__GNUC__) -#pragma endregion // temperature -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlInit -typedef ctl_result_t (CTL_APICALL *ctl_pfnInit_t)( - ctl_init_args_t*, - ctl_api_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlClose -typedef ctl_result_t (CTL_APICALL *ctl_pfnClose_t)( - ctl_api_handle_t - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSetRuntimePath -typedef ctl_result_t (CTL_APICALL *ctl_pfnSetRuntimePath_t)( - ctl_runtime_path_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlWaitForPropertyChange -typedef ctl_result_t (CTL_APICALL *ctl_pfnWaitForPropertyChange_t)( - ctl_device_adapter_handle_t, - ctl_wait_property_change_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlReservedCall -typedef ctl_result_t (CTL_APICALL *ctl_pfnReservedCall_t)( - ctl_device_adapter_handle_t, - ctl_reserved_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSupported3DCapabilities -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSupported3DCapabilities_t)( - ctl_device_adapter_handle_t, - ctl_3d_feature_caps_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSet3DFeature -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSet3DFeature_t)( - ctl_device_adapter_handle_t, - ctl_3d_feature_getset_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlCheckDriverVersion -typedef ctl_result_t (CTL_APICALL *ctl_pfnCheckDriverVersion_t)( - ctl_device_adapter_handle_t, - ctl_version_info_t - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumerateDevices -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateDevices_t)( - ctl_api_handle_t, - uint32_t*, - ctl_device_adapter_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumerateDisplayOutputs -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateDisplayOutputs_t)( - ctl_device_adapter_handle_t, - uint32_t*, - ctl_display_output_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumerateI2CPinPairs -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateI2CPinPairs_t)( - ctl_device_adapter_handle_t, - uint32_t*, - ctl_i2c_pin_pair_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetDeviceProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetDeviceProperties_t)( - ctl_device_adapter_handle_t, - ctl_device_adapter_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetDisplayProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetDisplayProperties_t)( - ctl_display_output_handle_t, - ctl_display_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetAdaperDisplayEncoderProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetAdaperDisplayEncoderProperties_t)( - ctl_display_output_handle_t, - ctl_adapter_display_encoder_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetZeDevice -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetZeDevice_t)( - ctl_device_adapter_handle_t, - void*, - void** - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSharpnessCaps -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSharpnessCaps_t)( - ctl_display_output_handle_t, - ctl_sharpness_caps_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetCurrentSharpness -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetCurrentSharpness_t)( - ctl_display_output_handle_t, - ctl_sharpness_settings_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSetCurrentSharpness -typedef ctl_result_t (CTL_APICALL *ctl_pfnSetCurrentSharpness_t)( - ctl_display_output_handle_t, - ctl_sharpness_settings_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlI2CAccess -typedef ctl_result_t (CTL_APICALL *ctl_pfnI2CAccess_t)( - ctl_display_output_handle_t, - ctl_i2c_access_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlI2CAccessOnPinPair -typedef ctl_result_t (CTL_APICALL *ctl_pfnI2CAccessOnPinPair_t)( - ctl_i2c_pin_pair_handle_t, - ctl_i2c_access_pinpair_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlAUXAccess -typedef ctl_result_t (CTL_APICALL *ctl_pfnAUXAccess_t)( - ctl_display_output_handle_t, - ctl_aux_access_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetPowerOptimizationCaps -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetPowerOptimizationCaps_t)( - ctl_display_output_handle_t, - ctl_power_optimization_caps_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetPowerOptimizationSetting -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetPowerOptimizationSetting_t)( - ctl_display_output_handle_t, - ctl_power_optimization_settings_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSetPowerOptimizationSetting -typedef ctl_result_t (CTL_APICALL *ctl_pfnSetPowerOptimizationSetting_t)( - ctl_display_output_handle_t, - ctl_power_optimization_settings_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSetBrightnessSetting -typedef ctl_result_t (CTL_APICALL *ctl_pfnSetBrightnessSetting_t)( - ctl_display_output_handle_t, - ctl_set_brightness_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetBrightnessSetting -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetBrightnessSetting_t)( - ctl_display_output_handle_t, - ctl_get_brightness_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPixelTransformationGetConfig -typedef ctl_result_t (CTL_APICALL *ctl_pfnPixelTransformationGetConfig_t)( - ctl_display_output_handle_t, - ctl_pixtx_pipe_get_config_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPixelTransformationSetConfig -typedef ctl_result_t (CTL_APICALL *ctl_pfnPixelTransformationSetConfig_t)( - ctl_display_output_handle_t, - ctl_pixtx_pipe_set_config_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPanelDescriptorAccess -typedef ctl_result_t (CTL_APICALL *ctl_pfnPanelDescriptorAccess_t)( - ctl_display_output_handle_t, - ctl_panel_descriptor_access_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSupportedRetroScalingCapability -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSupportedRetroScalingCapability_t)( - ctl_device_adapter_handle_t, - ctl_retro_scaling_caps_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSetRetroScaling -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetRetroScaling_t)( - ctl_device_adapter_handle_t, - ctl_retro_scaling_settings_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSupportedScalingCapability -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSupportedScalingCapability_t)( - ctl_display_output_handle_t, - ctl_scaling_caps_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetCurrentScaling -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetCurrentScaling_t)( - ctl_display_output_handle_t, - ctl_scaling_settings_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSetCurrentScaling -typedef ctl_result_t (CTL_APICALL *ctl_pfnSetCurrentScaling_t)( - ctl_display_output_handle_t, - ctl_scaling_settings_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetLACEConfig -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetLACEConfig_t)( - ctl_display_output_handle_t, - ctl_lace_config_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSetLACEConfig -typedef ctl_result_t (CTL_APICALL *ctl_pfnSetLACEConfig_t)( - ctl_display_output_handle_t, - ctl_lace_config_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSoftwarePSR -typedef ctl_result_t (CTL_APICALL *ctl_pfnSoftwarePSR_t)( - ctl_display_output_handle_t, - ctl_sw_psr_settings_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetIntelArcSyncInfoForMonitor -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetIntelArcSyncInfoForMonitor_t)( - ctl_display_output_handle_t, - ctl_intel_arc_sync_monitor_params_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumerateMuxDevices -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateMuxDevices_t)( - ctl_api_handle_t, - uint32_t*, - ctl_mux_output_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetMuxProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetMuxProperties_t)( - ctl_mux_output_handle_t, - ctl_mux_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSwitchMux -typedef ctl_result_t (CTL_APICALL *ctl_pfnSwitchMux_t)( - ctl_mux_output_handle_t, - ctl_display_output_handle_t - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetIntelArcSyncProfile -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetIntelArcSyncProfile_t)( - ctl_display_output_handle_t, - ctl_intel_arc_sync_profile_params_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSetIntelArcSyncProfile -typedef ctl_result_t (CTL_APICALL *ctl_pfnSetIntelArcSyncProfile_t)( - ctl_display_output_handle_t, - ctl_intel_arc_sync_profile_params_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEdidManagement -typedef ctl_result_t (CTL_APICALL *ctl_pfnEdidManagement_t)( - ctl_display_output_handle_t, - ctl_edid_management_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSetCustomMode -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetCustomMode_t)( - ctl_display_output_handle_t, - ctl_get_set_custom_mode_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSetCombinedDisplay -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetCombinedDisplay_t)( - ctl_device_adapter_handle_t, - ctl_combined_display_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSetDisplayGenlock -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDisplayGenlock_t)( - ctl_device_adapter_handle_t*, - ctl_genlock_args_t*, - uint32_t, - ctl_device_adapter_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetVblankTimestamp -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetVblankTimestamp_t)( - ctl_display_output_handle_t, - ctl_vblank_ts_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlLinkDisplayAdapters -typedef ctl_result_t (CTL_APICALL *ctl_pfnLinkDisplayAdapters_t)( - ctl_device_adapter_handle_t, - ctl_lda_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlUnlinkDisplayAdapters -typedef ctl_result_t (CTL_APICALL *ctl_pfnUnlinkDisplayAdapters_t)( - ctl_device_adapter_handle_t - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetLinkedDisplayAdapters -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetLinkedDisplayAdapters_t)( - ctl_device_adapter_handle_t, - ctl_lda_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSetDynamicContrastEnhancement -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDynamicContrastEnhancement_t)( - ctl_display_output_handle_t, - ctl_dce_args_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSetWireFormat -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetWireFormat_t)( - ctl_display_output_handle_t, - ctl_get_set_wire_format_config_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSetDisplaySettings -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDisplaySettings_t)( - ctl_display_output_handle_t, - ctl_display_settings_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumEngineGroups -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumEngineGroups_t)( - ctl_device_adapter_handle_t, - uint32_t*, - ctl_engine_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEngineGetProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnEngineGetProperties_t)( - ctl_engine_handle_t, - ctl_engine_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEngineGetActivity -typedef ctl_result_t (CTL_APICALL *ctl_pfnEngineGetActivity_t)( - ctl_engine_handle_t, - ctl_engine_stats_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumFans -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumFans_t)( - ctl_device_adapter_handle_t, - uint32_t*, - ctl_fan_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFanGetProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnFanGetProperties_t)( - ctl_fan_handle_t, - ctl_fan_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFanGetConfig -typedef ctl_result_t (CTL_APICALL *ctl_pfnFanGetConfig_t)( - ctl_fan_handle_t, - ctl_fan_config_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFanSetDefaultMode -typedef ctl_result_t (CTL_APICALL *ctl_pfnFanSetDefaultMode_t)( - ctl_fan_handle_t - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFanSetFixedSpeedMode -typedef ctl_result_t (CTL_APICALL *ctl_pfnFanSetFixedSpeedMode_t)( - ctl_fan_handle_t, - const ctl_fan_speed_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFanSetSpeedTableMode -typedef ctl_result_t (CTL_APICALL *ctl_pfnFanSetSpeedTableMode_t)( - ctl_fan_handle_t, - const ctl_fan_speed_table_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFanGetState -typedef ctl_result_t (CTL_APICALL *ctl_pfnFanGetState_t)( - ctl_fan_handle_t, - ctl_fan_speed_units_t, - int32_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumFrequencyDomains -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumFrequencyDomains_t)( - ctl_device_adapter_handle_t, - uint32_t*, - ctl_freq_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFrequencyGetProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetProperties_t)( - ctl_freq_handle_t, - ctl_freq_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFrequencyGetAvailableClocks -typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetAvailableClocks_t)( - ctl_freq_handle_t, - uint32_t*, - double* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFrequencyGetRange -typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetRange_t)( - ctl_freq_handle_t, - ctl_freq_range_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFrequencySetRange -typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencySetRange_t)( - ctl_freq_handle_t, - const ctl_freq_range_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFrequencyGetState -typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetState_t)( - ctl_freq_handle_t, - ctl_freq_state_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlFrequencyGetThrottleTime -typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetThrottleTime_t)( - ctl_freq_handle_t, - ctl_freq_throttle_time_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSupportedVideoProcessingCapabilities -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSupportedVideoProcessingCapabilities_t)( - ctl_device_adapter_handle_t, - ctl_video_processing_feature_caps_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetSetVideoProcessingFeature -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetVideoProcessingFeature_t)( - ctl_device_adapter_handle_t, - ctl_video_processing_feature_getset_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumMemoryModules -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumMemoryModules_t)( - ctl_device_adapter_handle_t, - uint32_t*, - ctl_mem_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlMemoryGetProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnMemoryGetProperties_t)( - ctl_mem_handle_t, - ctl_mem_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlMemoryGetState -typedef ctl_result_t (CTL_APICALL *ctl_pfnMemoryGetState_t)( - ctl_mem_handle_t, - ctl_mem_state_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlMemoryGetBandwidth -typedef ctl_result_t (CTL_APICALL *ctl_pfnMemoryGetBandwidth_t)( - ctl_mem_handle_t, - ctl_mem_bandwidth_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockGetProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGetProperties_t)( - ctl_device_adapter_handle_t, - ctl_oc_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockWaiverSet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockWaiverSet_t)( - ctl_device_adapter_handle_t - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockGpuFrequencyOffsetGet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuFrequencyOffsetGet_t)( - ctl_device_adapter_handle_t, - double* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockGpuFrequencyOffsetSet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuFrequencyOffsetSet_t)( - ctl_device_adapter_handle_t, - double - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockGpuVoltageOffsetGet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuVoltageOffsetGet_t)( - ctl_device_adapter_handle_t, - double* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockGpuVoltageOffsetSet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuVoltageOffsetSet_t)( - ctl_device_adapter_handle_t, - double - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockGpuLockGet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuLockGet_t)( - ctl_device_adapter_handle_t, - ctl_oc_vf_pair_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockGpuLockSet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuLockSet_t)( - ctl_device_adapter_handle_t, - ctl_oc_vf_pair_t - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockVramFrequencyOffsetGet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramFrequencyOffsetGet_t)( - ctl_device_adapter_handle_t, - double* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockVramFrequencyOffsetSet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramFrequencyOffsetSet_t)( - ctl_device_adapter_handle_t, - double - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockVramVoltageOffsetGet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramVoltageOffsetGet_t)( - ctl_device_adapter_handle_t, - double* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockVramVoltageOffsetSet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramVoltageOffsetSet_t)( - ctl_device_adapter_handle_t, - double - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockPowerLimitGet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockPowerLimitGet_t)( - ctl_device_adapter_handle_t, - double* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockPowerLimitSet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockPowerLimitSet_t)( - ctl_device_adapter_handle_t, - double - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockTemperatureLimitGet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockTemperatureLimitGet_t)( - ctl_device_adapter_handle_t, - double* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockTemperatureLimitSet -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockTemperatureLimitSet_t)( - ctl_device_adapter_handle_t, - double - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPowerTelemetryGet -typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerTelemetryGet_t)( - ctl_device_adapter_handle_t, - ctl_power_telemetry_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlOverclockResetToDefault -typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockResetToDefault_t)( - ctl_device_adapter_handle_t - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPciGetProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnPciGetProperties_t)( - ctl_device_adapter_handle_t, - ctl_pci_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPciGetState -typedef ctl_result_t (CTL_APICALL *ctl_pfnPciGetState_t)( - ctl_device_adapter_handle_t, - ctl_pci_state_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumPowerDomains -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumPowerDomains_t)( - ctl_device_adapter_handle_t, - uint32_t*, - ctl_pwr_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPowerGetProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerGetProperties_t)( - ctl_pwr_handle_t, - ctl_power_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPowerGetEnergyCounter -typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerGetEnergyCounter_t)( - ctl_pwr_handle_t, - ctl_power_energy_counter_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPowerGetLimits -typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerGetLimits_t)( - ctl_pwr_handle_t, - ctl_power_limits_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlPowerSetLimits -typedef ctl_result_t (CTL_APICALL *ctl_pfnPowerSetLimits_t)( - ctl_pwr_handle_t, - const ctl_power_limits_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumTemperatureSensors -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumTemperatureSensors_t)( - ctl_device_adapter_handle_t, - uint32_t*, - ctl_temp_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlTemperatureGetProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnTemperatureGetProperties_t)( - ctl_temp_handle_t, - ctl_temp_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlTemperatureGetState -typedef ctl_result_t (CTL_APICALL *ctl_pfnTemperatureGetState_t)( - ctl_temp_handle_t, - double* - ); - - -#if defined(__cplusplus) -} // extern "C" -#endif - -#endif // _CTL_API_H \ No newline at end of file diff --git a/include/cApiWrapper.cpp b/include/cApiWrapper.cpp deleted file mode 100644 index 9acdd38..0000000 --- a/include/cApiWrapper.cpp +++ /dev/null @@ -1,4776 +0,0 @@ -//=========================================================================== -//Copyright (C) 2022-23 Intel Corporation -// -// -// -//SPDX-License-Identifier: MIT -//-------------------------------------------------------------------------- - -/** - * - * @file ctl_api.cpp - * @version v1-r1 - * - */ - -// Note: UWP applications should have defined WINDOWS_UWP in their compiler settings -// Also at this point, it's easier by not enabling pre-compiled option to compile this file -// Not all functionalities are tested for a UWP application - -#include -#include - -//#define CTL_APIEXPORT - -#include "igcl_api.h" - -///////////////////////////////////////////////////////////////////////////////// -// -// Implementation of wrapper functions -// -static HINSTANCE hinstLib = NULL; -static ctl_runtime_path_args_t* pRuntimeArgs = NULL; - -HINSTANCE GetLoaderHandle(void) -{ - return hinstLib; -} - -/** - * @brief Function to get DLL name based on app version - * - */ - -#if defined(_WIN64) - #define CTL_DLL_NAME L"ControlLib" -#else - #define CTL_DLL_NAME L"ControlLib32" -#endif -#define CTL_DLL_PATH_LEN 512 - -ctl_result_t GetControlAPIDLLPath(ctl_init_args_t* pInitArgs, wchar_t* pwcDLLPath) -{ - if ((NULL == pRuntimeArgs) || (NULL == pRuntimeArgs->pRuntimePath)) - { - // Load the requested DLL based on major version in init args - uint16_t majorVersion = CTL_MAJOR_VERSION(pInitArgs->AppVersion); - - // If caller's major version is higher than the DLL's, then simply not support the caller! - // This is not supposed to happen as wrapper is part of the app itself which includes igcl_api.h with right major version - if (majorVersion > CTL_IMPL_MAJOR_VERSION) - return CTL_RESULT_ERROR_UNSUPPORTED_VERSION; - -#if (CTL_IMPL_MAJOR_VERSION > 1) - if (majorVersion > 1) - StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s%d.dll", CTL_DLL_NAME, majorVersion); - else // just control_api.dll - StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s.dll", CTL_DLL_NAME); -#else - StringCbPrintfW(pwcDLLPath,CTL_DLL_PATH_LEN,L"%s.dll", CTL_DLL_NAME); -#endif - - } - else if (pRuntimeArgs->pRuntimePath) - { - // caller specified a specific RT, use it instead - wcsncpy_s(pwcDLLPath, CTL_DLL_PATH_LEN, pRuntimeArgs->pRuntimePath, CTL_DLL_PATH_LEN - 1); - } - return CTL_RESULT_SUCCESS; -} - - - -/** -* @brief Control Api Init -* -* @details -* - Control Api Init -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pInitDesc` -* + `nullptr == phAPIHandle` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlInit( - ctl_init_args_t* pInitDesc, ///< [in][out] App's control API version - ctl_api_handle_t* phAPIHandle ///< [in][out][release] Control API handle - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - // special code - only for ctlInit() - if (NULL == hinstLib) - { - wchar_t strDLLPath[CTL_DLL_PATH_LEN]; - result = GetControlAPIDLLPath(pInitDesc, strDLLPath); - if (result == CTL_RESULT_SUCCESS) - { -#ifdef WINDOWS_UWP - hinstLib = LoadPackagedLibrary(strDLLPath, 0); -#else - DWORD dwFlags = LOAD_LIBRARY_SEARCH_SYSTEM32; -#ifdef _DEBUG - dwFlags = dwFlags | LOAD_LIBRARY_SEARCH_APPLICATION_DIR; -#endif - hinstLib = LoadLibraryExW(strDLLPath, NULL, dwFlags); -#endif - if (NULL == hinstLib) - { - result = CTL_RESULT_ERROR_LOAD; - } - else if (pRuntimeArgs) - { - ctlSetRuntimePath(pRuntimeArgs); - } - } - } - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnInit_t pfnInit = (ctl_pfnInit_t)GetProcAddress(hinstLibPtr, "ctlInit"); - if (pfnInit) - { - result = pfnInit(pInitDesc, phAPIHandle); - } - } - - return result; -} - - -/** -* @brief Control Api Destroy -* -* @details -* - Control Api Close -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hAPIHandle` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlClose( - ctl_api_handle_t hAPIHandle ///< [in][release] Control API implementation handle obtained during init - ///< call - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnClose_t pfnClose = (ctl_pfnClose_t)GetProcAddress(hinstLibPtr, "ctlClose"); - if (pfnClose) - { - result = pfnClose(hAPIHandle); - } - } - - // special code - only for ctlClose() - // might get CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER - // if its open by another caller do not free the instance handle - if( result == CTL_RESULT_SUCCESS) - { - if (NULL != hinstLib) - { - FreeLibrary(hinstLib); - hinstLib = NULL; - } - } - // set runtime args back to NULL - // no need to free this as it's allocated by caller - pRuntimeArgs = NULL; - return result; -} - - -/** -* @brief Runtime path -* -* @details -* - Control Api set runtime path. Optional call from a loader which allows -* the loaded runtime to enumerate only the adapters which the specified -* runtime is responsible for. This is done usually by a loader or by -* callers who know how to get the specific runtime of interest. This -* call right now is reserved for use by Intel components. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlSetRuntimePath( - ctl_runtime_path_args_t* pArgs ///< [in] Runtime path - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSetRuntimePath_t pfnSetRuntimePath = (ctl_pfnSetRuntimePath_t)GetProcAddress(hinstLibPtr, "ctlSetRuntimePath"); - if (pfnSetRuntimePath) - { - result = pfnSetRuntimePath(pArgs); - } - } - - // special code - only for ctlSetRuntimePath() - // might get CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER - // if its open by another caller do not free the instance handle - else if (pArgs->pRuntimePath) - { - // this is a case where the caller app is interested in loading a RT directly - // IMPORTANT NOTE: Free pArgs and pArgs->pRuntimePath only after ctlInit() call - pRuntimeArgs = pArgs; - result = CTL_RESULT_SUCCESS; - } - return result; -} - - -/** -* @brief Wait for a property change. Note that this is a blocking call -* -* @details -* - Wait for a property change in display, 3d, media etc. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceAdapter` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlWaitForPropertyChange( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter - ctl_wait_property_change_args_t* pArgs ///< [in] Argument containing information about which property changes to - ///< listen for - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnWaitForPropertyChange_t pfnWaitForPropertyChange = (ctl_pfnWaitForPropertyChange_t)GetProcAddress(hinstLibPtr, "ctlWaitForPropertyChange"); - if (pfnWaitForPropertyChange) - { - result = pfnWaitForPropertyChange(hDeviceAdapter, pArgs); - } - } - - return result; -} - - -/** -* @brief Reserved function -* -* @details -* - Reserved function -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceAdapter` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlReservedCall( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter - ctl_reserved_args_t* pArgs ///< [in] Argument containing information - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnReservedCall_t pfnReservedCall = (ctl_pfnReservedCall_t)GetProcAddress(hinstLibPtr, "ctlReservedCall"); - if (pfnReservedCall) - { - result = pfnReservedCall(hDeviceAdapter, pArgs); - } - } - - return result; -} - - -/** -* @brief Get 3D capabilities -* -* @details -* - The application gets 3D properties -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pFeatureCaps` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetSupported3DCapabilities( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_3d_feature_caps_t* pFeatureCaps ///< [in,out][release] 3D properties - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSupported3DCapabilities_t pfnGetSupported3DCapabilities = (ctl_pfnGetSupported3DCapabilities_t)GetProcAddress(hinstLibPtr, "ctlGetSupported3DCapabilities"); - if (pfnGetSupported3DCapabilities) - { - result = pfnGetSupported3DCapabilities(hDAhandle, pFeatureCaps); - } - } - - return result; -} - - -/** -* @brief Get/Set 3D feature -* -* @details -* - 3D feature details -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pFeature` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetSet3DFeature( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_3d_feature_getset_t* pFeature ///< [in][release] 3D feature get/set parameter - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSet3DFeature_t pfnGetSet3DFeature = (ctl_pfnGetSet3DFeature_t)GetProcAddress(hinstLibPtr, "ctlGetSet3DFeature"); - if (pfnGetSet3DFeature) - { - result = pfnGetSet3DFeature(hDAhandle, pFeature); - } - } - - return result; -} - - -/** -* @brief Check Driver version -* -* @details -* - The application checks driver version -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceAdapter` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlCheckDriverVersion( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter - ctl_version_info_t version_info ///< [in][release] Driver version info - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnCheckDriverVersion_t pfnCheckDriverVersion = (ctl_pfnCheckDriverVersion_t)GetProcAddress(hinstLibPtr, "ctlCheckDriverVersion"); - if (pfnCheckDriverVersion) - { - result = pfnCheckDriverVersion(hDeviceAdapter, version_info); - } - } - - return result; -} - - -/** -* @brief Enumerate devices -* -* @details -* - The application enumerates all device adapters in the system -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hAPIHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlEnumerateDevices( - ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned - ///< by the CtlInit function - uint32_t* pCount, ///< [in,out][release] pointer to the number of device instances. If count - ///< is zero, then the api will update the value with the total - ///< number of drivers available. If count is non-zero, then the api will - ///< only retrieve the number of drivers. - ///< If count is larger than the number of drivers available, then the api - ///< will update the value with the correct number of drivers available. - ctl_device_adapter_handle_t* phDevices ///< [in,out][optional][release][range(0, *pCount)] array of driver - ///< instance handles - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumerateDevices_t pfnEnumerateDevices = (ctl_pfnEnumerateDevices_t)GetProcAddress(hinstLibPtr, "ctlEnumerateDevices"); - if (pfnEnumerateDevices) - { - result = pfnEnumerateDevices(hAPIHandle, pCount, phDevices); - } - } - - return result; -} - - -/** -* @brief Enumerate display outputs -* -* @details -* - Enumerates display output capabilities -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceAdapter` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlEnumerateDisplayOutputs( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter - uint32_t* pCount, ///< [in,out][release] pointer to the number of display output instances. - ///< If count is zero, then the api will update the value with the total - ///< number of outputs available. If count is non-zero, then the api will - ///< only retrieve the number of outputs. - ///< If count is larger than the number of drivers available, then the api - ///< will update the value with the correct number of drivers available. - ctl_display_output_handle_t* phDisplayOutputs ///< [in,out][optional][release][range(0, *pCount)] array of display output - ///< instance handles - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumerateDisplayOutputs_t pfnEnumerateDisplayOutputs = (ctl_pfnEnumerateDisplayOutputs_t)GetProcAddress(hinstLibPtr, "ctlEnumerateDisplayOutputs"); - if (pfnEnumerateDisplayOutputs) - { - result = pfnEnumerateDisplayOutputs(hDeviceAdapter, pCount, phDisplayOutputs); - } - } - - return result; -} - - -/** -* @brief Enumerate I2C Pin Pairs -* -* @details -* - Returns available list of I2C Pin-Pairs on a requested adapter -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceAdapter` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "The incoming pointer pCount is null" -* - ::CTL_RESULT_ERROR_INVALID_SIZE - "The supplied Count is not equal to actual number of i2c pin-pair instances" -*/ -ctl_result_t CTL_APICALL -ctlEnumerateI2CPinPairs( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to device adapter - uint32_t* pCount, ///< [in,out][release] pointer to the number of i2c pin-pair instances. If - ///< count is zero, then the api will update the value with the total - ///< number of i2c pin-pair instances available. If count is non-zero and - ///< matches the avaialble number of pin-pairs, then the api will only - ///< return the avaialble number of i2c pin-pair instances in phI2cPinPairs. - ctl_i2c_pin_pair_handle_t* phI2cPinPairs ///< [out][optional][release][range(0, *pCount)] array of i2c pin pair - ///< instance handles. Need to be allocated by Caller when supplying the - ///< *pCount > 0. - ///< If Count is not equal to actual number of i2c pin-pair instances, it - ///< will return CTL_RESULT_ERROR_INVALID_SIZE. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumerateI2CPinPairs_t pfnEnumerateI2CPinPairs = (ctl_pfnEnumerateI2CPinPairs_t)GetProcAddress(hinstLibPtr, "ctlEnumerateI2CPinPairs"); - if (pfnEnumerateI2CPinPairs) - { - result = pfnEnumerateI2CPinPairs(hDeviceAdapter, pCount, phI2cPinPairs); - } - } - - return result; -} - - -/** -* @brief Get Device Properties -* -* @details -* - The application gets device properties -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetDeviceProperties( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to control device adapter - ctl_device_adapter_properties_t* pProperties ///< [in,out][release] Query result for device properties - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetDeviceProperties_t pfnGetDeviceProperties = (ctl_pfnGetDeviceProperties_t)GetProcAddress(hinstLibPtr, "ctlGetDeviceProperties"); - if (pfnGetDeviceProperties) - { - result = pfnGetDeviceProperties(hDAhandle, pProperties); - } - } - - return result; -} - - -/** -* @brief Get Display Properties -* -* @details -* - The application gets display properties -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetDisplayProperties( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_display_properties_t* pProperties ///< [in,out][release] Query result for display properties - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetDisplayProperties_t pfnGetDisplayProperties = (ctl_pfnGetDisplayProperties_t)GetProcAddress(hinstLibPtr, "ctlGetDisplayProperties"); - if (pfnGetDisplayProperties) - { - result = pfnGetDisplayProperties(hDisplayOutput, pProperties); - } - } - - return result; -} - - -/** -* @brief Get Adapter Display encoder Properties -* -* @details -* - The application gets the graphic adapters display encoder properties -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetAdaperDisplayEncoderProperties( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_adapter_display_encoder_properties_t* pProperties ///< [in,out][release] Query result for adapter display encoder properties - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetAdaperDisplayEncoderProperties_t pfnGetAdaperDisplayEncoderProperties = (ctl_pfnGetAdaperDisplayEncoderProperties_t)GetProcAddress(hinstLibPtr, "ctlGetAdaperDisplayEncoderProperties"); - if (pfnGetAdaperDisplayEncoderProperties) - { - result = pfnGetAdaperDisplayEncoderProperties(hDisplayOutput, pProperties); - } - } - - return result; -} - - -/** -* @brief Get Level0 Device handle -* -* @details -* - The application gets OneAPI Level0 Device handles -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pZeDevice` -* + `nullptr == hInstance` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetZeDevice( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - void* pZeDevice, ///< [out][release] ze_device handle - void** hInstance ///< [out][release] Module instance which caller can use to get export - ///< functions directly - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetZeDevice_t pfnGetZeDevice = (ctl_pfnGetZeDevice_t)GetProcAddress(hinstLibPtr, "ctlGetZeDevice"); - if (pfnGetZeDevice) - { - result = pfnGetZeDevice(hDAhandle, pZeDevice, hInstance); - } - } - - return result; -} - - -/** -* @brief Get Sharpness capability -* -* @details -* - Returns sharpness capability -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pSharpnessCaps` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetSharpnessCaps( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_sharpness_caps_t* pSharpnessCaps ///< [in,out][release] Query result for sharpness capability - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSharpnessCaps_t pfnGetSharpnessCaps = (ctl_pfnGetSharpnessCaps_t)GetProcAddress(hinstLibPtr, "ctlGetSharpnessCaps"); - if (pfnGetSharpnessCaps) - { - result = pfnGetSharpnessCaps(hDisplayOutput, pSharpnessCaps); - } - } - - return result; -} - - -/** -* @brief Get Sharpness setting -* -* @details -* - Returns current sharpness settings -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pSharpnessSettings` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetCurrentSharpness( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_sharpness_settings_t* pSharpnessSettings ///< [in,out][release] Query result for sharpness current settings - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetCurrentSharpness_t pfnGetCurrentSharpness = (ctl_pfnGetCurrentSharpness_t)GetProcAddress(hinstLibPtr, "ctlGetCurrentSharpness"); - if (pfnGetCurrentSharpness) - { - result = pfnGetCurrentSharpness(hDisplayOutput, pSharpnessSettings); - } - } - - return result; -} - - -/** -* @brief Set Sharpness setting -* -* @details -* - Set current sharpness settings -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pSharpnessSettings` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlSetCurrentSharpness( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_sharpness_settings_t* pSharpnessSettings ///< [in][release] Set sharpness current settings - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSetCurrentSharpness_t pfnSetCurrentSharpness = (ctl_pfnSetCurrentSharpness_t)GetProcAddress(hinstLibPtr, "ctlSetCurrentSharpness"); - if (pfnSetCurrentSharpness) - { - result = pfnSetCurrentSharpness(hDisplayOutput, pSharpnessSettings); - } - } - - return result; -} - - -/** -* @brief I2C Access -* -* @details -* - Interface to access I2C using display handle as identifier. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pI2cAccessArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid I2C data size" -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -*/ -ctl_result_t CTL_APICALL -ctlI2CAccess( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_i2c_access_args_t* pI2cAccessArgs ///< [in,out] I2c access arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnI2CAccess_t pfnI2CAccess = (ctl_pfnI2CAccess_t)GetProcAddress(hinstLibPtr, "ctlI2CAccess"); - if (pfnI2CAccess) - { - result = pfnI2CAccess(hDisplayOutput, pI2cAccessArgs); - } - } - - return result; -} - - -/** -* @brief I2C Access On Pin Pair -* -* @details -* - Interface to access I2C using pin-pair handle as identifier. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hI2cPinPair` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pI2cAccessArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid I2C data size" -* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid Args passed" -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" -* - ::CTL_RESULT_ERROR_EXTERNAL_DISPLAY_ATTACHED - "Write to Address not allowed when Display is connected" -*/ -ctl_result_t CTL_APICALL -ctlI2CAccessOnPinPair( - ctl_i2c_pin_pair_handle_t hI2cPinPair, ///< [in] Handle to I2C pin pair. - ctl_i2c_access_pinpair_args_t* pI2cAccessArgs ///< [in,out] I2c access arguments. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnI2CAccessOnPinPair_t pfnI2CAccessOnPinPair = (ctl_pfnI2CAccessOnPinPair_t)GetProcAddress(hinstLibPtr, "ctlI2CAccessOnPinPair"); - if (pfnI2CAccessOnPinPair) - { - result = pfnI2CAccessOnPinPair(hI2cPinPair, pI2cAccessArgs); - } - } - - return result; -} - - -/** -* @brief Aux Access -* -* @details -* - The application does Aux access, PSR needs to be disabled for AUX -* call. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pAuxAccessArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid AUX data size" -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_INVALID_AUX_ACCESS_FLAG - "Invalid flag for AUX access" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -*/ -ctl_result_t CTL_APICALL -ctlAUXAccess( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_aux_access_args_t* pAuxAccessArgs ///< [in,out] Aux access arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnAUXAccess_t pfnAUXAccess = (ctl_pfnAUXAccess_t)GetProcAddress(hinstLibPtr, "ctlAUXAccess"); - if (pfnAUXAccess) - { - result = pfnAUXAccess(hDisplayOutput, pAuxAccessArgs); - } - } - - return result; -} - - -/** -* @brief Get Power optimization features -* -* @details -* - Returns power optimization capabilities -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pPowerOptimizationCaps` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetPowerOptimizationCaps( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_power_optimization_caps_t* pPowerOptimizationCaps ///< [in,out][release] Query result for power optimization features - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetPowerOptimizationCaps_t pfnGetPowerOptimizationCaps = (ctl_pfnGetPowerOptimizationCaps_t)GetProcAddress(hinstLibPtr, "ctlGetPowerOptimizationCaps"); - if (pfnGetPowerOptimizationCaps) - { - result = pfnGetPowerOptimizationCaps(hDisplayOutput, pPowerOptimizationCaps); - } - } - - return result; -} - - -/** -* @brief Get Power optimization setting -* -* @details -* - Returns power optimization setting for a specific feature -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pPowerOptimizationSettings` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG - "Unsupported PowerOptimizationFeature" -* - ::CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST - "DPST is supported only in DC Mode" -*/ -ctl_result_t CTL_APICALL -ctlGetPowerOptimizationSetting( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_power_optimization_settings_t* pPowerOptimizationSettings ///< [in,out][release] Power optimization data to be fetched - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetPowerOptimizationSetting_t pfnGetPowerOptimizationSetting = (ctl_pfnGetPowerOptimizationSetting_t)GetProcAddress(hinstLibPtr, "ctlGetPowerOptimizationSetting"); - if (pfnGetPowerOptimizationSetting) - { - result = pfnGetPowerOptimizationSetting(hDisplayOutput, pPowerOptimizationSettings); - } - } - - return result; -} - - -/** -* @brief Set Power optimization setting -* -* @details -* - Set power optimization setting for a specific feature -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pPowerOptimizationSettings` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_POWERFEATURE_OPTIMIZATION_FLAG - "Unsupported PowerOptimizationFeature" -* - ::CTL_RESULT_ERROR_INVALID_POWERSOURCE_TYPE_FOR_DPST - "DPST is supported only in DC Mode" -* - ::CTL_RESULT_ERROR_SET_FBC_FEATURE_NOT_SUPPORTED - "Set FBC Feature not supported" -*/ -ctl_result_t CTL_APICALL -ctlSetPowerOptimizationSetting( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_power_optimization_settings_t* pPowerOptimizationSettings ///< [in][release] Power optimization data to be applied - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSetPowerOptimizationSetting_t pfnSetPowerOptimizationSetting = (ctl_pfnSetPowerOptimizationSetting_t)GetProcAddress(hinstLibPtr, "ctlSetPowerOptimizationSetting"); - if (pfnSetPowerOptimizationSetting) - { - result = pfnSetPowerOptimizationSetting(hDisplayOutput, pPowerOptimizationSettings); - } - } - - return result; -} - - -/** -* @brief Set Brightness on companion display -* -* @details -* - Set Brightness for a target display. Currently support is only for -* companion display. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pSetBrightnessSetting` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid Brightness data passed as argument" -* - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Currently Brightness API is supported only on companion display" -*/ -ctl_result_t CTL_APICALL -ctlSetBrightnessSetting( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_set_brightness_t* pSetBrightnessSetting ///< [in][release] Brightness settings to be applied - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSetBrightnessSetting_t pfnSetBrightnessSetting = (ctl_pfnSetBrightnessSetting_t)GetProcAddress(hinstLibPtr, "ctlSetBrightnessSetting"); - if (pfnSetBrightnessSetting) - { - result = pfnSetBrightnessSetting(hDisplayOutput, pSetBrightnessSetting); - } - } - - return result; -} - - -/** -* @brief Get Brightness setting -* -* @details -* - Get Brightness for a target display. Currently support is only for -* companion display. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pGetBrightnessSetting` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Currently Brightness API is supported only on companion display" -*/ -ctl_result_t CTL_APICALL -ctlGetBrightnessSetting( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_get_brightness_t* pGetBrightnessSetting ///< [out][release] Brightness settings data to be fetched - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetBrightnessSetting_t pfnGetBrightnessSetting = (ctl_pfnGetBrightnessSetting_t)GetProcAddress(hinstLibPtr, "ctlGetBrightnessSetting"); - if (pfnGetBrightnessSetting) - { - result = pfnGetBrightnessSetting(hDisplayOutput, pGetBrightnessSetting); - } - } - - return result; -} - - -/** -* @brief Pixel transformation get pipe configuration -* -* @details -* - The application does pixel transformation get pipe configuration -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pPixTxGetConfigArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -* - ::CTL_RESULT_ERROR_INVALID_PIXTX_GET_CONFIG_QUERY_TYPE - "Invalid query type" -* - ::CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID - "Invalid block id" -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PIXTX_BLOCK_CONFIG_MEMORY - "Insufficient memery allocated for BlockConfigs" -* - ::CTL_RESULT_ERROR_3DLUT_INVALID_PIPE - "Invalid pipe for 3dlut" -* - ::CTL_RESULT_ERROR_3DLUT_INVALID_DATA - "Invalid 3dlut data" -* - ::CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR - "3dlut not supported in HDR" -* - ::CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION - "Invalid 3dlut operation" -* - ::CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL - "3dlut call unsuccessful" -*/ -ctl_result_t CTL_APICALL -ctlPixelTransformationGetConfig( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_pixtx_pipe_get_config_t* pPixTxGetConfigArgs///< [in,out] Pixel transformation get pipe configiguration arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPixelTransformationGetConfig_t pfnPixelTransformationGetConfig = (ctl_pfnPixelTransformationGetConfig_t)GetProcAddress(hinstLibPtr, "ctlPixelTransformationGetConfig"); - if (pfnPixelTransformationGetConfig) - { - result = pfnPixelTransformationGetConfig(hDisplayOutput, pPixTxGetConfigArgs); - } - } - - return result; -} - - -/** -* @brief Pixel transformation set pipe configuration -* -* @details -* - The application does pixel transformation set pipe configuration -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pPixTxSetConfigArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -* - ::CTL_RESULT_ERROR_INVALID_PIXTX_SET_CONFIG_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INVALID_SET_CONFIG_NUMBER_OF_SAMPLES - "Invalid number of samples" -* - ::CTL_RESULT_ERROR_INVALID_PIXTX_BLOCK_ID - "Invalid block id" -* - ::CTL_RESULT_ERROR_PERSISTANCE_NOT_SUPPORTED - "Persistance not supported" -* - ::CTL_RESULT_ERROR_3DLUT_INVALID_PIPE - "Invalid pipe for 3dlut" -* - ::CTL_RESULT_ERROR_3DLUT_INVALID_DATA - "Invalid 3dlut data" -* - ::CTL_RESULT_ERROR_3DLUT_NOT_SUPPORTED_IN_HDR - "3dlut not supported in HDR" -* - ::CTL_RESULT_ERROR_3DLUT_INVALID_OPERATION - "Invalid 3dlut operation" -* - ::CTL_RESULT_ERROR_3DLUT_UNSUCCESSFUL - "3dlut call unsuccessful" -*/ -ctl_result_t CTL_APICALL -ctlPixelTransformationSetConfig( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_pixtx_pipe_set_config_t* pPixTxSetConfigArgs///< [in,out] Pixel transformation set pipe configiguration arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPixelTransformationSetConfig_t pfnPixelTransformationSetConfig = (ctl_pfnPixelTransformationSetConfig_t)GetProcAddress(hinstLibPtr, "ctlPixelTransformationSetConfig"); - if (pfnPixelTransformationSetConfig) - { - result = pfnPixelTransformationSetConfig(hDisplayOutput, pPixTxSetConfigArgs); - } - } - - return result; -} - - -/** -* @brief Panel Descriptor Access -* -* @details -* - The application does EDID or Display ID access -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pPanelDescriptorAccessArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -*/ -ctl_result_t CTL_APICALL -ctlPanelDescriptorAccess( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_panel_descriptor_access_args_t* pPanelDescriptorAccessArgs ///< [in,out] Panel descriptor access arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPanelDescriptorAccess_t pfnPanelDescriptorAccess = (ctl_pfnPanelDescriptorAccess_t)GetProcAddress(hinstLibPtr, "ctlPanelDescriptorAccess"); - if (pfnPanelDescriptorAccess) - { - result = pfnPanelDescriptorAccess(hDisplayOutput, pPanelDescriptorAccessArgs); - } - } - - return result; -} - - -/** -* @brief Get Supported Retro Scaling Types -* -* @details -* - Returns supported retro scaling capabilities -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pRetroScalingCaps` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetSupportedRetroScalingCapability( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter - ctl_retro_scaling_caps_t* pRetroScalingCaps ///< [in,out][release] Query result for supported retro scaling types - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSupportedRetroScalingCapability_t pfnGetSupportedRetroScalingCapability = (ctl_pfnGetSupportedRetroScalingCapability_t)GetProcAddress(hinstLibPtr, "ctlGetSupportedRetroScalingCapability"); - if (pfnGetSupportedRetroScalingCapability) - { - result = pfnGetSupportedRetroScalingCapability(hDAhandle, pRetroScalingCaps); - } - } - - return result; -} - - -/** -* @brief Get/Set Retro Scaling -* -* @details -* - Get or Set the status of retro scaling.This Api will do a physical -* modeset resulting in flash on the screen -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pGetSetRetroScalingType` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetSetRetroScaling( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter - ctl_retro_scaling_settings_t* pGetSetRetroScalingType ///< [in,out][release] Get or Set the retro scaling type - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSetRetroScaling_t pfnGetSetRetroScaling = (ctl_pfnGetSetRetroScaling_t)GetProcAddress(hinstLibPtr, "ctlGetSetRetroScaling"); - if (pfnGetSetRetroScaling) - { - result = pfnGetSetRetroScaling(hDAhandle, pGetSetRetroScalingType); - } - } - - return result; -} - - -/** -* @brief Get Supported Scaling Types -* -* @details -* - Returns supported scaling capabilities -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pScalingCaps` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetSupportedScalingCapability( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_scaling_caps_t* pScalingCaps ///< [in,out][release] Query result for supported scaling types - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSupportedScalingCapability_t pfnGetSupportedScalingCapability = (ctl_pfnGetSupportedScalingCapability_t)GetProcAddress(hinstLibPtr, "ctlGetSupportedScalingCapability"); - if (pfnGetSupportedScalingCapability) - { - result = pfnGetSupportedScalingCapability(hDisplayOutput, pScalingCaps); - } - } - - return result; -} - - -/** -* @brief Get Current Scaling -* -* @details -* - Returns current active scaling -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pGetCurrentScalingType` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetCurrentScaling( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_scaling_settings_t* pGetCurrentScalingType ///< [in,out][release] Query result for active scaling types - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetCurrentScaling_t pfnGetCurrentScaling = (ctl_pfnGetCurrentScaling_t)GetProcAddress(hinstLibPtr, "ctlGetCurrentScaling"); - if (pfnGetCurrentScaling) - { - result = pfnGetCurrentScaling(hDisplayOutput, pGetCurrentScalingType); - } - } - - return result; -} - - -/** -* @brief Set Scaling Type -* -* @details -* - Returns current active scaling -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pSetScalingType` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlSetCurrentScaling( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_scaling_settings_t* pSetScalingType ///< [in,out][release] Set scaling types - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSetCurrentScaling_t pfnSetCurrentScaling = (ctl_pfnSetCurrentScaling_t)GetProcAddress(hinstLibPtr, "ctlSetCurrentScaling"); - if (pfnSetCurrentScaling) - { - result = pfnSetCurrentScaling(hDisplayOutput, pSetScalingType); - } - } - - return result; -} - - -/** -* @brief Get LACE Config -* -* @details -* - Returns current LACE Config -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pLaceConfig` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED - "Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data passed by user" -*/ -ctl_result_t CTL_APICALL -ctlGetLACEConfig( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_lace_config_t* pLaceConfig ///< [out]Lace configuration - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetLACEConfig_t pfnGetLACEConfig = (ctl_pfnGetLACEConfig_t)GetProcAddress(hinstLibPtr, "ctlGetLACEConfig"); - if (pfnGetLACEConfig) - { - result = pfnGetLACEConfig(hDisplayOutput, pLaceConfig); - } - } - - return result; -} - - -/** -* @brief Sets LACE Config -* -* @details -* - Sets LACE Config -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pLaceConfig` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_LACE_INVALID_DATA_ARGUMENT_PASSED - "Lace Incorrrect AggressivePercent data or LuxVsAggressive Map data passed by user" -*/ -ctl_result_t CTL_APICALL -ctlSetLACEConfig( - ctl_display_output_handle_t hDisplayOutput, ///< [in]Handle to display output - ctl_lace_config_t* pLaceConfig ///< [in]Lace configuration - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSetLACEConfig_t pfnSetLACEConfig = (ctl_pfnSetLACEConfig_t)GetProcAddress(hinstLibPtr, "ctlSetLACEConfig"); - if (pfnSetLACEConfig) - { - result = pfnSetLACEConfig(hDisplayOutput, pLaceConfig); - } - } - - return result; -} - - -/** -* @brief Get Software PSR caps/Set software PSR State -* -* @details -* - Returns Software PSR status or Sets Software PSR capabilities. This is -* a reserved capability. By default, software PSR is not supported/will -* not be enabled, need application to activate it, please contact Intel -* for activation. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pSoftwarePsrSetting` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlSoftwarePSR( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_sw_psr_settings_t* pSoftwarePsrSetting ///< [in,out][release] Get Software PSR caps/state or Set Software PSR - ///< state - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSoftwarePSR_t pfnSoftwarePSR = (ctl_pfnSoftwarePSR_t)GetProcAddress(hinstLibPtr, "ctlSoftwarePSR"); - if (pfnSoftwarePSR) - { - result = pfnSoftwarePSR(hDisplayOutput, pSoftwarePsrSetting); - } - } - - return result; -} - - -/** -* @brief Get Intel Arc Sync information for monitor -* -* @details -* - Returns Intel Arc Sync information for selected monitor -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pIntelArcSyncMonitorParams` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetIntelArcSyncInfoForMonitor( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_intel_arc_sync_monitor_params_t* pIntelArcSyncMonitorParams ///< [in,out][release] Intel Arc Sync params for monitor - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetIntelArcSyncInfoForMonitor_t pfnGetIntelArcSyncInfoForMonitor = (ctl_pfnGetIntelArcSyncInfoForMonitor_t)GetProcAddress(hinstLibPtr, "ctlGetIntelArcSyncInfoForMonitor"); - if (pfnGetIntelArcSyncInfoForMonitor) - { - result = pfnGetIntelArcSyncInfoForMonitor(hDisplayOutput, pIntelArcSyncMonitorParams); - } - } - - return result; -} - - -/** -* @brief Enumerate Display MUX Devices on this system across adapters -* -* @details -* - The application enumerates all MUX devices in the system -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hAPIHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -* + `nullptr == phMuxDevices` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlEnumerateMuxDevices( - ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned - ///< by the CtlInit function - uint32_t* pCount, ///< [in,out][release] pointer to the number of MUX device instances. If - ///< input count is zero, then the api will update the value with the total - ///< number of MUX devices available and return the Count value. If input - ///< count is non-zero, then the api will only retrieve the number of MUX Devices. - ///< If count is larger than the number of MUX devices available, then the - ///< api will update the value with the correct number of MUX devices available. - ctl_mux_output_handle_t* phMuxDevices ///< [out][range(0, *pCount)] array of MUX device instance handles - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumerateMuxDevices_t pfnEnumerateMuxDevices = (ctl_pfnEnumerateMuxDevices_t)GetProcAddress(hinstLibPtr, "ctlEnumerateMuxDevices"); - if (pfnEnumerateMuxDevices) - { - result = pfnEnumerateMuxDevices(hAPIHandle, pCount, phMuxDevices); - } - } - - return result; -} - - -/** -* @brief Get Display Mux properties -* -* @details -* - Get the propeties of the Mux device -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hMuxDevice` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pMuxProperties` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetMuxProperties( - ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle - ctl_mux_properties_t* pMuxProperties ///< [in,out] MUX device properties - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetMuxProperties_t pfnGetMuxProperties = (ctl_pfnGetMuxProperties_t)GetProcAddress(hinstLibPtr, "ctlGetMuxProperties"); - if (pfnGetMuxProperties) - { - result = pfnGetMuxProperties(hMuxDevice, pMuxProperties); - } - } - - return result; -} - - -/** -* @brief Switch Mux output -* -* @details -* - Switches the MUX output -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hMuxDevice` -* + `nullptr == hInactiveDisplayOutput` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlSwitchMux( - ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle - ctl_display_output_handle_t hInactiveDisplayOutput ///< [out] Input selection for this MUX, which if active will drive the - ///< output of this MUX device. This should be one of the display output - ///< handles reported under this MUX device's properties. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSwitchMux_t pfnSwitchMux = (ctl_pfnSwitchMux_t)GetProcAddress(hinstLibPtr, "ctlSwitchMux"); - if (pfnSwitchMux) - { - result = pfnSwitchMux(hMuxDevice, hInactiveDisplayOutput); - } - } - - return result; -} - - -/** -* @brief Get Intel Arc Sync profile -* -* @details -* - Returns Intel Arc Sync profile for selected monitor -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pIntelArcSyncProfileParams` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetIntelArcSyncProfile( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_intel_arc_sync_profile_params_t* pIntelArcSyncProfileParams ///< [in,out][release] Intel Arc Sync params for monitor - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetIntelArcSyncProfile_t pfnGetIntelArcSyncProfile = (ctl_pfnGetIntelArcSyncProfile_t)GetProcAddress(hinstLibPtr, "ctlGetIntelArcSyncProfile"); - if (pfnGetIntelArcSyncProfile) - { - result = pfnGetIntelArcSyncProfile(hDisplayOutput, pIntelArcSyncProfileParams); - } - } - - return result; -} - - -/** -* @brief Set Intel Arc Sync profile -* -* @details -* - Sets Intel Arc Sync profile for selected monitor. In a mux situation, -* this API should be called for all display IDs associated with a -* physical display. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pIntelArcSyncProfileParams` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlSetIntelArcSyncProfile( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_intel_arc_sync_profile_params_t* pIntelArcSyncProfileParams ///< [in][release] Intel Arc Sync params for monitor - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSetIntelArcSyncProfile_t pfnSetIntelArcSyncProfile = (ctl_pfnSetIntelArcSyncProfile_t)GetProcAddress(hinstLibPtr, "ctlSetIntelArcSyncProfile"); - if (pfnSetIntelArcSyncProfile) - { - result = pfnSetIntelArcSyncProfile(hDisplayOutput, pIntelArcSyncProfileParams); - } - } - - return result; -} - - -/** -* @brief EDID Management allows managing an output's EDID or Plugged Status. -* -* @details -* - To manage output's EDID or Display ID. Supports native DP SST and HDMI -* Display types. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pEdidManagementArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" -* - ::CTL_RESULT_ERROR_DISPLAY_NOT_ATTACHED - "Error for Output Device not attached" -* - ::CTL_RESULT_ERROR_OUT_OF_DEVICE_MEMORY - "Insufficient device memory to satisfy call" -* - ::CTL_RESULT_ERROR_DATA_NOT_FOUND - "Requested EDID data not present." -*/ -ctl_result_t CTL_APICALL -ctlEdidManagement( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_edid_management_args_t* pEdidManagementArgs ///< [in,out] EDID management arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEdidManagement_t pfnEdidManagement = (ctl_pfnEdidManagement_t)GetProcAddress(hinstLibPtr, "ctlEdidManagement"); - if (pfnEdidManagement) - { - result = pfnEdidManagement(hDisplayOutput, pEdidManagementArgs); - } - } - - return result; -} - - -/** -* @brief Get/Set Custom mode. -* -* @details -* - To get or set custom mode. -* - Add custom source mode operation supports only single mode additon at -* a time. -* - Remove custom source mode operation supports single or multiple mode -* removal at a time. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCustomModeArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernal mode driver call failure" -* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" -* - ::CTL_RESULT_ERROR_CUSTOM_MODE_STANDARD_CUSTOM_MODE_EXISTS - "Standard custom mode exists" -* - ::CTL_RESULT_ERROR_CUSTOM_MODE_NON_CUSTOM_MATCHING_MODE_EXISTS - "Non custom matching mode exists" -* - ::CTL_RESULT_ERROR_CUSTOM_MODE_INSUFFICIENT_MEMORY - "Custom mode insufficent memory" -*/ -ctl_result_t CTL_APICALL -ctlGetSetCustomMode( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_get_set_custom_mode_args_t* pCustomModeArgs ///< [in,out] Custom mode arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSetCustomMode_t pfnGetSetCustomMode = (ctl_pfnGetSetCustomMode_t)GetProcAddress(hinstLibPtr, "ctlGetSetCustomMode"); - if (pfnGetSetCustomMode) - { - result = pfnGetSetCustomMode(hDisplayOutput, pCustomModeArgs); - } - } - - return result; -} - - -/** -* @brief Get/Set Combined Display -* -* @details -* - To get or set combined display with given Child Targets on a Single -* GPU or across identical GPUs. Multi-GPU(MGPU) combined display is -* reserved i.e. it is not public and requires special application GUID. -* MGPU Combined Display will get activated or deactivated in next boot. -* MGPU scenario will internally link the associated adapters via Linked -* Display Adapter Call, with supplied hDeviceAdapter being the LDA -* Primary. If Genlock and enabled in Driver registry and supported by -* given Display Config, MGPU Combined Display will enable MGPU Genlock -* with supplied hDeviceAdapter being the Genlock Primary Adapter and the -* First Child Display being the Primary Display. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceAdapter` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCombinedDisplayArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -* - ::CTL_RESULT_ERROR_FEATURE_NOT_SUPPORTED - "Combined Display feature is not supported in this platform" -* - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" -*/ -ctl_result_t CTL_APICALL -ctlGetSetCombinedDisplay( - ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] Handle to control device adapter - ctl_combined_display_args_t* pCombinedDisplayArgs ///< [in,out] Setup and get combined display arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSetCombinedDisplay_t pfnGetSetCombinedDisplay = (ctl_pfnGetSetCombinedDisplay_t)GetProcAddress(hinstLibPtr, "ctlGetSetCombinedDisplay"); - if (pfnGetSetCombinedDisplay) - { - result = pfnGetSetCombinedDisplay(hDeviceAdapter, pCombinedDisplayArgs); - } - } - - return result; -} - - -/** -* @brief Get/Set Display Genlock -* -* @details -* - To get or set Display Genlock. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == hDeviceAdapter` -* + `nullptr == pGenlockArgs` -* + `nullptr == hFailureDeviceAdapter` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_INVALID_SIZE - "Invalid topology structure size" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -*/ -ctl_result_t CTL_APICALL -ctlGetSetDisplayGenlock( - ctl_device_adapter_handle_t* hDeviceAdapter, ///< [in][release] Handle to control device adapter - ctl_genlock_args_t* pGenlockArgs, ///< [in,out] Display Genlock operation and information - uint32_t AdapterCount, ///< [in] Number of device adapters - ctl_device_adapter_handle_t* hFailureDeviceAdapter ///< [out] Handle to address the failure device adapter in an error case - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSetDisplayGenlock_t pfnGetSetDisplayGenlock = (ctl_pfnGetSetDisplayGenlock_t)GetProcAddress(hinstLibPtr, "ctlGetSetDisplayGenlock"); - if (pfnGetSetDisplayGenlock) - { - result = pfnGetSetDisplayGenlock(hDeviceAdapter, pGenlockArgs, AdapterCount, hFailureDeviceAdapter); - } - } - - return result; -} - - -/** -* @brief Get Vblank Timestamp -* -* @details -* - To get a list of vblank timestamps in microseconds for each child -* target of a display. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pVblankTSArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS - "Insufficient permissions" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -*/ -ctl_result_t CTL_APICALL -ctlGetVblankTimestamp( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_vblank_ts_args_t* pVblankTSArgs ///< [out] Get vblank timestamp arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetVblankTimestamp_t pfnGetVblankTimestamp = (ctl_pfnGetVblankTimestamp_t)GetProcAddress(hinstLibPtr, "ctlGetVblankTimestamp"); - if (pfnGetVblankTimestamp) - { - result = pfnGetVblankTimestamp(hDisplayOutput, pVblankTSArgs); - } - } - - return result; -} - - -/** -* @brief Link Display Adapters -* -* @details -* - To Link Display Adapters. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hPrimaryAdapter` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pLdaArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -* - ::CTL_RESULT_ERROR_ADAPTER_ALREADY_LINKED - "Adapter is already linked" -*/ -ctl_result_t CTL_APICALL -ctlLinkDisplayAdapters( - ctl_device_adapter_handle_t hPrimaryAdapter, ///< [in][release] Handle to Primary adapter in LDA chain - ctl_lda_args_t* pLdaArgs ///< [in] Link Display Adapters Arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnLinkDisplayAdapters_t pfnLinkDisplayAdapters = (ctl_pfnLinkDisplayAdapters_t)GetProcAddress(hinstLibPtr, "ctlLinkDisplayAdapters"); - if (pfnLinkDisplayAdapters) - { - result = pfnLinkDisplayAdapters(hPrimaryAdapter, pLdaArgs); - } - } - - return result; -} - - -/** -* @brief Unlink Display Adapters -* -* @details -* - To Unlink Display Adapters -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hPrimaryAdapter` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -* - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" -*/ -ctl_result_t CTL_APICALL -ctlUnlinkDisplayAdapters( - ctl_device_adapter_handle_t hPrimaryAdapter ///< [in][release] Handle to Primary adapter in LDA chain - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnUnlinkDisplayAdapters_t pfnUnlinkDisplayAdapters = (ctl_pfnUnlinkDisplayAdapters_t)GetProcAddress(hinstLibPtr, "ctlUnlinkDisplayAdapters"); - if (pfnUnlinkDisplayAdapters) - { - result = pfnUnlinkDisplayAdapters(hPrimaryAdapter); - } - } - - return result; -} - - -/** -* @brief Get Linked Display Adapters -* -* @details -* - To return list of Linked Display Adapters. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hPrimaryAdapter` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pLdaArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -* - ::CTL_RESULT_ERROR_ADAPTER_NOT_SUPPORTED_ON_LDA_SECONDARY - "Unsupported (secondary) adapter handle passed" -*/ -ctl_result_t CTL_APICALL -ctlGetLinkedDisplayAdapters( - ctl_device_adapter_handle_t hPrimaryAdapter, ///< [in][release] Handle to Primary adapter in LDA chain - ctl_lda_args_t* pLdaArgs ///< [out] Link Display Adapters Arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetLinkedDisplayAdapters_t pfnGetLinkedDisplayAdapters = (ctl_pfnGetLinkedDisplayAdapters_t)GetProcAddress(hinstLibPtr, "ctlGetLinkedDisplayAdapters"); - if (pfnGetLinkedDisplayAdapters) - { - result = pfnGetLinkedDisplayAdapters(hPrimaryAdapter, pLdaArgs); - } - } - - return result; -} - - -/** -* @brief Get/Set Dynamic Contrast Enhancement -* -* @details -* - To get the DCE feature status and, if feature is enabled, returns the -* current histogram, or to set the brightness at the phase-in speed -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pDceArgs` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" -*/ -ctl_result_t CTL_APICALL -ctlGetSetDynamicContrastEnhancement( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_dce_args_t* pDceArgs ///< [in,out] Dynamic Contrast Enhancement arguments - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSetDynamicContrastEnhancement_t pfnGetSetDynamicContrastEnhancement = (ctl_pfnGetSetDynamicContrastEnhancement_t)GetProcAddress(hinstLibPtr, "ctlGetSetDynamicContrastEnhancement"); - if (pfnGetSetDynamicContrastEnhancement) - { - result = pfnGetSetDynamicContrastEnhancement(hDisplayOutput, pDceArgs); - } - } - - return result; -} - - -/** -* @brief Get/Set Color Format and Color Depth -* -* @details -* - Get and Set the Color Format and Color Depth of a target -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pGetSetWireFormatSetting` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid data passed as argument, WireFormat is not supported" -* - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -*/ -ctl_result_t CTL_APICALL -ctlGetSetWireFormat( - ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output - ctl_get_set_wire_format_config_t* pGetSetWireFormatSetting ///< [in][release] Get/Set Wire Format settings to be fetched/applied - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSetWireFormat_t pfnGetSetWireFormat = (ctl_pfnGetSetWireFormat_t)GetProcAddress(hinstLibPtr, "ctlGetSetWireFormat"); - if (pfnGetSetWireFormat) - { - result = pfnGetSetWireFormat(hDisplayOutput, pGetSetWireFormatSetting); - } - } - - return result; -} - - -/** -* @brief Get/Set Display settings -* -* @details -* - To get/set end display settings like low latency, HDR10+ signaling -* etc. which are controlled via info-frames/secondary data packets -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDisplayOutput` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pDisplaySettings` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -* - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle" -* - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface" -* - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle" -* - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure" -* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed" -* - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer" -* - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type" -* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters" -*/ -ctl_result_t CTL_APICALL -ctlGetSetDisplaySettings( - ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output - ctl_display_settings_t* pDisplaySettings ///< [in,out] End display capabilities - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSetDisplaySettings_t pfnGetSetDisplaySettings = (ctl_pfnGetSetDisplaySettings_t)GetProcAddress(hinstLibPtr, "ctlGetSetDisplaySettings"); - if (pfnGetSetDisplaySettings) - { - result = pfnGetSetDisplaySettings(hDisplayOutput, pDisplaySettings); - } - } - - return result; -} - - -/** -* @brief Get handle of engine groups -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -*/ -ctl_result_t CTL_APICALL -ctlEnumEngineGroups( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumEngineGroups_t pfnEnumEngineGroups = (ctl_pfnEnumEngineGroups_t)GetProcAddress(hinstLibPtr, "ctlEnumEngineGroups"); - if (pfnEnumEngineGroups) - { - result = pfnEnumEngineGroups(hDAhandle, pCount, phEngine); - } - } - - return result; -} - - -/** -* @brief Get engine group properties -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hEngine` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -*/ -ctl_result_t CTL_APICALL -ctlEngineGetProperties( - ctl_engine_handle_t hEngine, ///< [in] Handle for the component. - ctl_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEngineGetProperties_t pfnEngineGetProperties = (ctl_pfnEngineGetProperties_t)GetProcAddress(hinstLibPtr, "ctlEngineGetProperties"); - if (pfnEngineGetProperties) - { - result = pfnEngineGetProperties(hEngine, pProperties); - } - } - - return result; -} - - -/** -* @brief Get the activity stats for an engine group -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hEngine` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pStats` -*/ -ctl_result_t CTL_APICALL -ctlEngineGetActivity( - ctl_engine_handle_t hEngine, ///< [in] Handle for the component. - ctl_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity - ///< counters. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEngineGetActivity_t pfnEngineGetActivity = (ctl_pfnEngineGetActivity_t)GetProcAddress(hinstLibPtr, "ctlEngineGetActivity"); - if (pfnEngineGetActivity) - { - result = pfnEngineGetActivity(hEngine, pStats); - } - } - - return result; -} - - -/** -* @brief Get handle of fans -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -*/ -ctl_result_t CTL_APICALL -ctlEnumFans( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to the adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumFans_t pfnEnumFans = (ctl_pfnEnumFans_t)GetProcAddress(hinstLibPtr, "ctlEnumFans"); - if (pfnEnumFans) - { - result = pfnEnumFans(hDAhandle, pCount, phFan); - } - } - - return result; -} - - -/** -* @brief Get fan properties -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFan` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -*/ -ctl_result_t CTL_APICALL -ctlFanGetProperties( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - ctl_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFanGetProperties_t pfnFanGetProperties = (ctl_pfnFanGetProperties_t)GetProcAddress(hinstLibPtr, "ctlFanGetProperties"); - if (pfnFanGetProperties) - { - result = pfnFanGetProperties(hFan, pProperties); - } - } - - return result; -} - - -/** -* @brief Get fan configurations and the current fan speed mode (default, fixed, -* temp-speed table) -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFan` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pConfig` -*/ -ctl_result_t CTL_APICALL -ctlFanGetConfig( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - ctl_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFanGetConfig_t pfnFanGetConfig = (ctl_pfnFanGetConfig_t)GetProcAddress(hinstLibPtr, "ctlFanGetConfig"); - if (pfnFanGetConfig) - { - result = pfnFanGetConfig(hFan, pConfig); - } - } - - return result; -} - - -/** -* @brief Configure the fan to run with hardware factory settings (set mode to -* ::CTL_FAN_SPEED_MODE_DEFAULT) -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFan` -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -* + User does not have permissions to make these modifications. -*/ -ctl_result_t CTL_APICALL -ctlFanSetDefaultMode( - ctl_fan_handle_t hFan ///< [in] Handle for the component. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFanSetDefaultMode_t pfnFanSetDefaultMode = (ctl_pfnFanSetDefaultMode_t)GetProcAddress(hinstLibPtr, "ctlFanSetDefaultMode"); - if (pfnFanSetDefaultMode) - { - result = pfnFanSetDefaultMode(hFan); - } - } - - return result; -} - - -/** -* @brief Configure the fan to rotate at a fixed speed (set mode to -* ::CTL_FAN_SPEED_MODE_FIXED) -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFan` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == speed` -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -* + User does not have permissions to make these modifications. -* - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE -* + Fixing the fan speed not supported by the hardware or the fan speed units are not supported. See ::ctl_fan_properties_t.supportedModes and ::ctl_fan_properties_t.supportedUnits. -*/ -ctl_result_t CTL_APICALL -ctlFanSetFixedSpeedMode( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - const ctl_fan_speed_t* speed ///< [in] The fixed fan speed setting - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFanSetFixedSpeedMode_t pfnFanSetFixedSpeedMode = (ctl_pfnFanSetFixedSpeedMode_t)GetProcAddress(hinstLibPtr, "ctlFanSetFixedSpeedMode"); - if (pfnFanSetFixedSpeedMode) - { - result = pfnFanSetFixedSpeedMode(hFan, speed); - } - } - - return result; -} - - -/** -* @brief Configure the fan to adjust speed based on a temperature/speed table -* (set mode to ::CTL_FAN_SPEED_MODE_TABLE) -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFan` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == speedTable` -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -* + User does not have permissions to make these modifications. -* - ::CTL_RESULT_ERROR_INVALID_ARGUMENT -* + The temperature/speed pairs in the array are not sorted on temperature from lowest to highest. -* - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE -* + Fan speed table not supported by the hardware or the fan speed units are not supported. See ::ctl_fan_properties_t.supportedModes and ::ctl_fan_properties_t.supportedUnits. -*/ -ctl_result_t CTL_APICALL -ctlFanSetSpeedTableMode( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - const ctl_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFanSetSpeedTableMode_t pfnFanSetSpeedTableMode = (ctl_pfnFanSetSpeedTableMode_t)GetProcAddress(hinstLibPtr, "ctlFanSetSpeedTableMode"); - if (pfnFanSetSpeedTableMode) - { - result = pfnFanSetSpeedTableMode(hFan, speedTable); - } - } - - return result; -} - - -/** -* @brief Get current state of a fan - current mode and speed -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFan` -* - CTL_RESULT_ERROR_INVALID_ENUMERATION -* + `::CTL_FAN_SPEED_UNITS_PERCENT < units` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pSpeed` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_FEATURE -* + The requested fan speed units are not supported. See ::ctl_fan_properties_t.supportedUnits. -*/ -ctl_result_t CTL_APICALL -ctlFanGetState( - ctl_fan_handle_t hFan, ///< [in] Handle for the component. - ctl_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. - int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units - ///< requested. A value of -1 indicates that the fan speed cannot be - ///< measured. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFanGetState_t pfnFanGetState = (ctl_pfnFanGetState_t)GetProcAddress(hinstLibPtr, "ctlFanGetState"); - if (pfnFanGetState) - { - result = pfnFanGetState(hFan, units, pSpeed); - } - } - - return result; -} - - -/** -* @brief Get handle of frequency domains -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -*/ -ctl_result_t CTL_APICALL -ctlEnumFrequencyDomains( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumFrequencyDomains_t pfnEnumFrequencyDomains = (ctl_pfnEnumFrequencyDomains_t)GetProcAddress(hinstLibPtr, "ctlEnumFrequencyDomains"); - if (pfnEnumFrequencyDomains) - { - result = pfnEnumFrequencyDomains(hDAhandle, pCount, phFrequency); - } - } - - return result; -} - - -/** -* @brief Get frequency properties - available frequencies -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFrequency` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -*/ -ctl_result_t CTL_APICALL -ctlFrequencyGetProperties( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - ctl_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFrequencyGetProperties_t pfnFrequencyGetProperties = (ctl_pfnFrequencyGetProperties_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetProperties"); - if (pfnFrequencyGetProperties) - { - result = pfnFrequencyGetProperties(hFrequency, pProperties); - } - } - - return result; -} - - -/** -* @brief Get available non-overclocked hardware clock frequencies for the -* frequency domain -* -* @details -* - The list of available frequencies is returned in order of slowest to -* fastest. -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFrequency` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -*/ -ctl_result_t CTL_APICALL -ctlFrequencyGetAvailableClocks( - ctl_freq_handle_t hFrequency, ///< [in] Device handle of the device. - uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. - ///< if count is zero, then the driver shall update the value with the - ///< total number of frequencies that are available. - ///< if count is greater than the number of frequencies that are available, - ///< then the driver shall update the value with the correct number of frequencies. - double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of - ///< MHz and sorted from slowest to fastest. - ///< if count is less than the number of frequencies that are available, - ///< then the driver shall only retrieve that number of frequencies. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFrequencyGetAvailableClocks_t pfnFrequencyGetAvailableClocks = (ctl_pfnFrequencyGetAvailableClocks_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetAvailableClocks"); - if (pfnFrequencyGetAvailableClocks) - { - result = pfnFrequencyGetAvailableClocks(hFrequency, pCount, phFrequency); - } - } - - return result; -} - - -/** -* @brief Get current frequency limits -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFrequency` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pLimits` -*/ -ctl_result_t CTL_APICALL -ctlFrequencyGetRange( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - ctl_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the - ///< specified domain. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFrequencyGetRange_t pfnFrequencyGetRange = (ctl_pfnFrequencyGetRange_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetRange"); - if (pfnFrequencyGetRange) - { - result = pfnFrequencyGetRange(hFrequency, pLimits); - } - } - - return result; -} - - -/** -* @brief Set frequency range between which the hardware can operate. -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFrequency` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pLimits` -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -* + User does not have permissions to make these modifications. -*/ -ctl_result_t CTL_APICALL -ctlFrequencySetRange( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - const ctl_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the - ///< specified domain. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFrequencySetRange_t pfnFrequencySetRange = (ctl_pfnFrequencySetRange_t)GetProcAddress(hinstLibPtr, "ctlFrequencySetRange"); - if (pfnFrequencySetRange) - { - result = pfnFrequencySetRange(hFrequency, pLimits); - } - } - - return result; -} - - -/** -* @brief Get current frequency state - frequency request, actual frequency, TDP -* limits -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFrequency` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pState` -*/ -ctl_result_t CTL_APICALL -ctlFrequencyGetState( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - ctl_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFrequencyGetState_t pfnFrequencyGetState = (ctl_pfnFrequencyGetState_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetState"); - if (pfnFrequencyGetState) - { - result = pfnFrequencyGetState(hFrequency, pState); - } - } - - return result; -} - - -/** -* @brief Get frequency throttle time -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hFrequency` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pThrottleTime` -*/ -ctl_result_t CTL_APICALL -ctlFrequencyGetThrottleTime( - ctl_freq_handle_t hFrequency, ///< [in] Handle for the component. - ctl_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the - ///< specified domain. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnFrequencyGetThrottleTime_t pfnFrequencyGetThrottleTime = (ctl_pfnFrequencyGetThrottleTime_t)GetProcAddress(hinstLibPtr, "ctlFrequencyGetThrottleTime"); - if (pfnFrequencyGetThrottleTime) - { - result = pfnFrequencyGetThrottleTime(hFrequency, pThrottleTime); - } - } - - return result; -} - - -/** -* @brief Get Video Processing capabilities -* -* @details -* - The application gets Video Processing properties -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pFeatureCaps` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetSupportedVideoProcessingCapabilities( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_video_processing_feature_caps_t* pFeatureCaps ///< [in,out][release] Video Processing properties - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSupportedVideoProcessingCapabilities_t pfnGetSupportedVideoProcessingCapabilities = (ctl_pfnGetSupportedVideoProcessingCapabilities_t)GetProcAddress(hinstLibPtr, "ctlGetSupportedVideoProcessingCapabilities"); - if (pfnGetSupportedVideoProcessingCapabilities) - { - result = pfnGetSupportedVideoProcessingCapabilities(hDAhandle, pFeatureCaps); - } - } - - return result; -} - - -/** -* @brief Get/Set Video Processing feature details -* -* @details -* - Video Processing feature details -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pFeature` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetSetVideoProcessingFeature( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_video_processing_feature_getset_t* pFeature ///< [in][release] Video Processing feature get/set parameter - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetSetVideoProcessingFeature_t pfnGetSetVideoProcessingFeature = (ctl_pfnGetSetVideoProcessingFeature_t)GetProcAddress(hinstLibPtr, "ctlGetSetVideoProcessingFeature"); - if (pfnGetSetVideoProcessingFeature) - { - result = pfnGetSetVideoProcessingFeature(hDAhandle, pFeature); - } - } - - return result; -} - - -/** -* @brief Get handle of memory modules -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -*/ -ctl_result_t CTL_APICALL -ctlEnumMemoryModules( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumMemoryModules_t pfnEnumMemoryModules = (ctl_pfnEnumMemoryModules_t)GetProcAddress(hinstLibPtr, "ctlEnumMemoryModules"); - if (pfnEnumMemoryModules) - { - result = pfnEnumMemoryModules(hDAhandle, pCount, phMemory); - } - } - - return result; -} - - -/** -* @brief Get memory properties -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hMemory` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -*/ -ctl_result_t CTL_APICALL -ctlMemoryGetProperties( - ctl_mem_handle_t hMemory, ///< [in] Handle for the component. - ctl_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnMemoryGetProperties_t pfnMemoryGetProperties = (ctl_pfnMemoryGetProperties_t)GetProcAddress(hinstLibPtr, "ctlMemoryGetProperties"); - if (pfnMemoryGetProperties) - { - result = pfnMemoryGetProperties(hMemory, pProperties); - } - } - - return result; -} - - -/** -* @brief Get memory state - health, allocated -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hMemory` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pState` -*/ -ctl_result_t CTL_APICALL -ctlMemoryGetState( - ctl_mem_handle_t hMemory, ///< [in] Handle for the component. - ctl_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnMemoryGetState_t pfnMemoryGetState = (ctl_pfnMemoryGetState_t)GetProcAddress(hinstLibPtr, "ctlMemoryGetState"); - if (pfnMemoryGetState) - { - result = pfnMemoryGetState(hMemory, pState); - } - } - - return result; -} - - -/** -* @brief Get memory bandwidth -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hMemory` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pBandwidth` -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -* + User does not have permissions to query this telemetry. -*/ -ctl_result_t CTL_APICALL -ctlMemoryGetBandwidth( - ctl_mem_handle_t hMemory, ///< [in] Handle for the component. - ctl_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the current health, free memory, total memory - ///< size. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnMemoryGetBandwidth_t pfnMemoryGetBandwidth = (ctl_pfnMemoryGetBandwidth_t)GetProcAddress(hinstLibPtr, "ctlMemoryGetBandwidth"); - if (pfnMemoryGetBandwidth) - { - result = pfnMemoryGetBandwidth(hMemory, pBandwidth); - } - } - - return result; -} - - -/** -* @brief Get overclock properties - available properties. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pOcProperties` -*/ -ctl_result_t CTL_APICALL -ctlOverclockGetProperties( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - ctl_oc_properties_t* pOcProperties ///< [in,out] The overclocking properties for the specified domain. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockGetProperties_t pfnOverclockGetProperties = (ctl_pfnOverclockGetProperties_t)GetProcAddress(hinstLibPtr, "ctlOverclockGetProperties"); - if (pfnOverclockGetProperties) - { - result = pfnOverclockGetProperties(hDeviceHandle, pOcProperties); - } - } - - return result; -} - - -/** -* @brief Overclock Waiver - Warranty Waiver. -* -* @details -* - Most of the overclock functions will return an error if the waiver is -* not set. This is because most overclock settings will increase the -* electric/thermal stress on the part and thus reduce its lifetime. -* - By setting the waiver, the user is indicate that they are accepting a -* reduction in the lifetime of the part. -* - It is the responsibility of overclock applications to notify each user -* at least once with a popup of the dangers and requiring acceptance. -* - Only once the user has accepted should this function be called by the -* application. -* - It is acceptable for the application to cache the user choice and call -* this function on future executions without issuing the popup. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -*/ -ctl_result_t CTL_APICALL -ctlOverclockWaiverSet( - ctl_device_adapter_handle_t hDeviceHandle ///< [in][release] Handle to display adapter - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockWaiverSet_t pfnOverclockWaiverSet = (ctl_pfnOverclockWaiverSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockWaiverSet"); - if (pfnOverclockWaiverSet) - { - result = pfnOverclockWaiverSet(hDeviceHandle); - } - } - - return result; -} - - -/** -* @brief Get the Overclock Frequency Offset for the GPU in MHz. -* -* @details -* - Determine the current frequency offset in effect (refer to -* ::ctlOverclockGpuFrequencyOffsetSet() for details). -* - The value returned may be different from the value that was previously -* set by the application depending on hardware limitations or if the -* function ::ctlOverclockGpuFrequencyOffsetSet() has been called or -* another application that has changed the value. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pOcFrequencyOffset` -*/ -ctl_result_t CTL_APICALL -ctlOverclockGpuFrequencyOffsetGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pOcFrequencyOffset ///< [in,out] The Turbo Overclocking Frequency Desired in MHz. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockGpuFrequencyOffsetGet_t pfnOverclockGpuFrequencyOffsetGet = (ctl_pfnOverclockGpuFrequencyOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuFrequencyOffsetGet"); - if (pfnOverclockGpuFrequencyOffsetGet) - { - result = pfnOverclockGpuFrequencyOffsetGet(hDeviceHandle, pOcFrequencyOffset); - } - } - - return result; -} - - -/** -* @brief Set the Overclock Frequency Offset for the GPU in MHZ. -* -* @details -* - The purpose of this function is to increase/decrease the frequency at -* which typical workloads will run within the same thermal budget. -* - The frequency offset is expressed in units of ±1MHz. -* - The actual operating frequency for each workload is not guaranteed to -* change exactly by the specified offset. -* - For positive frequency offsets, the factory maximum frequency may -* increase by up to the specified amount. -* - For negative frequency offsets, the overclock waiver must have been -* set since this can result in running the part at voltages beyond the -* part warrantee limits. An error is returned if the waiver has not been -* set. -* - Specifying large values for the frequency offset can lead to -* instability. It is recommended that changes are made in small -* increments and stability/performance measured running intense GPU -* workloads before increasing further. -* - This setting is not persistent through system reboots or driver -* resets/hangs. It is up to the overclock application to reapply the -* settings in those cases. -* - This setting can cause system/device instability. It is up to the -* overclock application to detect if the system has rebooted -* unexpectedly or the device was restarted. When this occurs, the -* application should not reapply the overclock settings automatically -* but instead return to previously known good settings or notify the -* user that the settings are not being applied. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -*/ -ctl_result_t CTL_APICALL -ctlOverclockGpuFrequencyOffsetSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double ocFrequencyOffset ///< [in] The Turbo Overclocking Frequency Desired in MHz. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockGpuFrequencyOffsetSet_t pfnOverclockGpuFrequencyOffsetSet = (ctl_pfnOverclockGpuFrequencyOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuFrequencyOffsetSet"); - if (pfnOverclockGpuFrequencyOffsetSet) - { - result = pfnOverclockGpuFrequencyOffsetSet(hDeviceHandle, ocFrequencyOffset); - } - } - - return result; -} - - -/** -* @brief Get the Overclock Gpu Voltage Offset in mV. -* -* @details -* - Determine the current voltage offset in effect on the hardware (refer -* to ::ctlOverclockGpuVoltageOffsetSet for details). -* - The value returned may be different from the value that was previously -* set by the application depending on hardware limitations or if the -* function ::ctlOverclockGpuVoltageOffsetSet has been called or another -* application that has changed the value. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pOcVoltageOffset` -*/ -ctl_result_t CTL_APICALL -ctlOverclockGpuVoltageOffsetGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pOcVoltageOffset ///< [in,out] The Turbo Overclocking Frequency Desired in mV. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockGpuVoltageOffsetGet_t pfnOverclockGpuVoltageOffsetGet = (ctl_pfnOverclockGpuVoltageOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuVoltageOffsetGet"); - if (pfnOverclockGpuVoltageOffsetGet) - { - result = pfnOverclockGpuVoltageOffsetGet(hDeviceHandle, pOcVoltageOffset); - } - } - - return result; -} - - -/** -* @brief Set the Overclock Gpu Voltage Offset in mV. -* -* @details -* - The purpose of this function is to attempt to run the GPU up to higher -* voltages beyond the part warrantee limits. This can permit running at -* even higher frequencies than can be obtained using the frequency -* offset setting, but at the risk of reducing the lifetime of the part. -* - The voltage offset is expressed in units of ±millivolts with values -* permitted down to a resolution of 1 millivolt. -* - The overclock waiver must be set before calling this function -* otherwise and error will be returned. -* - There is no guarantee that a workload can operate at the higher -* frequencies permitted by this setting. Significantly more heat will be -* generated at these high frequencies/voltages which will necessitate a -* good cooling solution. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -*/ -ctl_result_t CTL_APICALL -ctlOverclockGpuVoltageOffsetSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double ocVoltageOffset ///< [in] The Turbo Overclocking Frequency Desired in mV. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockGpuVoltageOffsetSet_t pfnOverclockGpuVoltageOffsetSet = (ctl_pfnOverclockGpuVoltageOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuVoltageOffsetSet"); - if (pfnOverclockGpuVoltageOffsetSet) - { - result = pfnOverclockGpuVoltageOffsetSet(hDeviceHandle, ocVoltageOffset); - } - } - - return result; -} - - -/** -* @brief Gets the Locked GPU Voltage for Overclocking in mV. -* -* @details -* - The purpose of this function is to determine if the current values of -* the frequency/voltage lock. -* - If the lock is not currently active, will return 0 for frequency and -* voltage. -* - Note that the operating frequency/voltage may be lower than these -* settings if power/thermal limits are exceeded. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pVfPair` -*/ -ctl_result_t CTL_APICALL -ctlOverclockGpuLockGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - ctl_oc_vf_pair_t* pVfPair ///< [out] The current locked voltage and frequency. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockGpuLockGet_t pfnOverclockGpuLockGet = (ctl_pfnOverclockGpuLockGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuLockGet"); - if (pfnOverclockGpuLockGet) - { - result = pfnOverclockGpuLockGet(hDeviceHandle, pVfPair); - } - } - - return result; -} - - -/** -* @brief Locks the GPU voltage for Overclocking in mV. -* -* @details -* - The purpose of this function is to provide an interface for scanners -* to lock the frequency and voltage to fixed values. -* - The frequency is expressed in units of MHz with a resolution of 1MHz. -* - The voltage is expressed in units of ±millivolts with values -* permitted down to a resolution of 1 millivolt. -* - The overclock waiver must be set since fixing the voltage at a high -* value puts unnecessary stress on the part. -* - The actual frequency may reduce depending on power/thermal -* limitations. -* - Requesting a frequency and/or voltage of 0 will return the hardware to -* dynamic frequency/voltage management with any previous frequency -* offset or voltage offset settings reapplied. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -*/ -ctl_result_t CTL_APICALL -ctlOverclockGpuLockSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - ctl_oc_vf_pair_t vFPair ///< [in] The current locked voltage and frequency. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockGpuLockSet_t pfnOverclockGpuLockSet = (ctl_pfnOverclockGpuLockSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuLockSet"); - if (pfnOverclockGpuLockSet) - { - result = pfnOverclockGpuLockSet(hDeviceHandle, vFPair); - } - } - - return result; -} - - -/** -* @brief Get the current Vram Frequency Offset in GT/s. -* -* @details -* - The purpose of this function is to return the current VRAM frequency -* offset in units of GT/s. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pOcFrequencyOffset` -*/ -ctl_result_t CTL_APICALL -ctlOverclockVramFrequencyOffsetGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pOcFrequencyOffset ///< [in,out] The current Memory Frequency in GT/s. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockVramFrequencyOffsetGet_t pfnOverclockVramFrequencyOffsetGet = (ctl_pfnOverclockVramFrequencyOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramFrequencyOffsetGet"); - if (pfnOverclockVramFrequencyOffsetGet) - { - result = pfnOverclockVramFrequencyOffsetGet(hDeviceHandle, pOcFrequencyOffset); - } - } - - return result; -} - - -/** -* @brief Set the desired Vram frquency Offset in GT/s -* -* @details -* - The purpose of this function is to increase/decrease the frequency of -* VRAM. -* - The frequency offset is expressed in units of GT/s with a minimum step -* size given by ::ctlOverclockGetProperties. -* - The actual operating frequency for each workload is not guaranteed to -* change exactly by the specified offset. -* - The waiver must be set using clibOverclockWaiverSet() before this -* function can be called. -* - This setting is not persistent through system reboots or driver -* resets/hangs. It is up to the overclock application to reapply the -* settings in those cases. -* - This setting can cause system/device instability. It is up to the -* overclock application to detect if the system has rebooted -* unexpectedly or the device was restarted. When this occurs, the -* application should not reapply the overclock settings automatically -* but instead return to previously known good settings or notify the -* user that the settings are not being applied. -* - If the memory controller doesn't support changes to frequency on the -* fly, one of the following return codes will be given: -* - ::CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory -* overclock will be applied when the device is reset or the system is -* rebooted. In this case, the overclock software should check if the -* overclock request was applied after the reset/reboot. If it was and -* when the overclock application shuts down gracefully and if the -* overclock application wants the setting to be persistent, the -* application should request the same overclock settings again so that -* they will be applied on the next reset/reboot. If this is not done, -* then every time the device is reset and overclock is requested, the -* device needs to be reset a second time. -* - ::CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory -* overclock will be applied when the system is rebooted. In this case, -* the overclock software should check if the overclock request was -* applied after the reboot. If it was and when the overclock application -* shuts down gracefully and if the overclock application wants the -* setting to be persistent, the application should request the same -* overclock settings again so that they will be applied on the next -* reset/reboot. If this is not done and the overclock setting is -* requested after the reboot has occurred, a second reboot will be -* required. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -*/ -ctl_result_t CTL_APICALL -ctlOverclockVramFrequencyOffsetSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double ocFrequencyOffset ///< [in] The desired Memory Frequency in GT/s. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockVramFrequencyOffsetSet_t pfnOverclockVramFrequencyOffsetSet = (ctl_pfnOverclockVramFrequencyOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramFrequencyOffsetSet"); - if (pfnOverclockVramFrequencyOffsetSet) - { - result = pfnOverclockVramFrequencyOffsetSet(hDeviceHandle, ocFrequencyOffset); - } - } - - return result; -} - - -/** -* @brief Get the Overclock Vram Voltage Offset in mV. -* -* @details -* - The purpose of this function is to increase/decrease the voltage of -* VRAM. -* - The voltage offset is expressed in units of millivolts with a minimum -* step size given by ::ctlOverclockGetProperties. -* - The waiver must be set using ::ctlOverclockWaiverSet before this -* function can be called. -* - This setting is not persistent through system reboots or driver -* resets/hangs. It is up to the overclock application to reapply the -* settings in those cases. -* - This setting can cause system/device instability. It is up to the -* overclock application to detect if the system has rebooted -* unexpectedly or the device was restarted. When this occurs, the -* application should not reapply the overclock settings automatically -* but instead return to previously known good settings or notify the -* user that the settings are not being applied. -* - If the memory controller doesn't support changes to voltage on the -* fly, one of the following return codes will be given: -* - ::CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory -* overclock will be applied when the device is reset or the system is -* rebooted. In this case, the overclock software should check if the -* overclock request was applied after the reset/reboot. If it was and -* when the overclock application shuts down gracefully and if the -* overclock application wants the setting to be persistent, the -* application should request the same overclock settings again so that -* they will be applied on the next reset/reboot. If this is not done, -* then every time the device is reset and overclock is requested, the -* device needs to be reset a second time. -* - ::CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory -* overclock will be applied when the system is rebooted. In this case, -* the overclock software should check if the overclock request was -* applied after the reboot. If it was and when the overclock application -* shuts down gracefully and if the overclock application wants the -* setting to be persistent, the application should request the same -* overclock settings again so that they will be applied on the next -* reset/reboot. If this is not done and the overclock setting is -* requested after the reboot has occurred, a second reboot will be -* required. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pVoltage` -*/ -ctl_result_t CTL_APICALL -ctlOverclockVramVoltageOffsetGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pVoltage ///< [out] The current locked voltage in mV. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockVramVoltageOffsetGet_t pfnOverclockVramVoltageOffsetGet = (ctl_pfnOverclockVramVoltageOffsetGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramVoltageOffsetGet"); - if (pfnOverclockVramVoltageOffsetGet) - { - result = pfnOverclockVramVoltageOffsetGet(hDeviceHandle, pVoltage); - } - } - - return result; -} - - -/** -* @brief Set the Overclock Vram Voltage Offset in mV. -* -* @details -* - The purpose of this function is to set the maximum sustained power -* limit. If the average GPU power averaged over a few seconds exceeds -* this value, the frequency of the GPU will be throttled. -* - Set a value of 0 to disable this power limit. In this case, the GPU -* frequency will not throttle due to average power but may hit other -* limits. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -*/ -ctl_result_t CTL_APICALL -ctlOverclockVramVoltageOffsetSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double voltage ///< [in] The voltage to be locked in mV. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockVramVoltageOffsetSet_t pfnOverclockVramVoltageOffsetSet = (ctl_pfnOverclockVramVoltageOffsetSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramVoltageOffsetSet"); - if (pfnOverclockVramVoltageOffsetSet) - { - result = pfnOverclockVramVoltageOffsetSet(hDeviceHandle, voltage); - } - } - - return result; -} - - -/** -* @brief Get the sustained power limit in mW. -* -* @details -* - The purpose of this function is to read the current sustained power -* limit. -* - A value of 0 means that the limit is disabled - the GPU frequency can -* run as high as possible until other limits are hit. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pSustainedPowerLimit` -*/ -ctl_result_t CTL_APICALL -ctlOverclockPowerLimitGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pSustainedPowerLimit ///< [in,out] The current sustained power limit in mW. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockPowerLimitGet_t pfnOverclockPowerLimitGet = (ctl_pfnOverclockPowerLimitGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockPowerLimitGet"); - if (pfnOverclockPowerLimitGet) - { - result = pfnOverclockPowerLimitGet(hDeviceHandle, pSustainedPowerLimit); - } - } - - return result; -} - - -/** -* @brief Set the sustained power limit in mW. -* -* @details -* - The purpose of this function is to set the maximum sustained power -* limit. If the average GPU power averaged over a few seconds exceeds -* this value, the frequency of the GPU will be throttled. -* - Set a value of 0 to disable this power limit. In this case, the GPU -* frequency will not throttle due to average power but may hit other -* limits. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -*/ -ctl_result_t CTL_APICALL -ctlOverclockPowerLimitSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double sustainedPowerLimit ///< [in] The desired sustained power limit in mW. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockPowerLimitSet_t pfnOverclockPowerLimitSet = (ctl_pfnOverclockPowerLimitSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockPowerLimitSet"); - if (pfnOverclockPowerLimitSet) - { - result = pfnOverclockPowerLimitSet(hDeviceHandle, sustainedPowerLimit); - } - } - - return result; -} - - -/** -* @brief Get the current temperature limit in Celsius. -* -* @details -* - The purpose of this function is to read the current thermal limit. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pTemperatureLimit` -*/ -ctl_result_t CTL_APICALL -ctlOverclockTemperatureLimitGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double* pTemperatureLimit ///< [in,out] The current temperature limit in Celsius. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockTemperatureLimitGet_t pfnOverclockTemperatureLimitGet = (ctl_pfnOverclockTemperatureLimitGet_t)GetProcAddress(hinstLibPtr, "ctlOverclockTemperatureLimitGet"); - if (pfnOverclockTemperatureLimitGet) - { - result = pfnOverclockTemperatureLimitGet(hDeviceHandle, pTemperatureLimit); - } - } - - return result; -} - - -/** -* @brief Set the temperature limit in Celsius. -* -* @details -* - The purpose of this function is to change the maximum thermal limit. -* When the GPU temperature exceeds this value, the GPU frequency will be -* throttled. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -*/ -ctl_result_t CTL_APICALL -ctlOverclockTemperatureLimitSet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - double temperatureLimit ///< [in] The desired temperature limit in Celsius. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockTemperatureLimitSet_t pfnOverclockTemperatureLimitSet = (ctl_pfnOverclockTemperatureLimitSet_t)GetProcAddress(hinstLibPtr, "ctlOverclockTemperatureLimitSet"); - if (pfnOverclockTemperatureLimitSet) - { - result = pfnOverclockTemperatureLimitSet(hDeviceHandle, temperatureLimit); - } - } - - return result; -} - - -/** -* @brief Get Power Telemetry. -* -* @details -* - Limited rate of 50 ms, any call under 50 ms will return the same -* information. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pTelemetryInfo` -*/ -ctl_result_t CTL_APICALL -ctlPowerTelemetryGet( - ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter - ctl_power_telemetry_t* pTelemetryInfo ///< [out] The overclocking properties for the specified domain. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPowerTelemetryGet_t pfnPowerTelemetryGet = (ctl_pfnPowerTelemetryGet_t)GetProcAddress(hinstLibPtr, "ctlPowerTelemetryGet"); - if (pfnPowerTelemetryGet) - { - result = pfnPowerTelemetryGet(hDeviceHandle, pTelemetryInfo); - } - } - - return result; -} - - -/** -* @brief Reset all Overclock Settings to stock -* -* @details -* - Reset all Overclock setting to default using single API call -* - This request resets any changes made to GpuFrequencyOffset, -* GpuVoltageOffset, PowerLimit, TemperatureLimit, GpuLock -* - This Doesn't reset any Fan Curve Changes. It can be reset using -* ctlFanSetDefaultMode -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDeviceHandle` -*/ -ctl_result_t CTL_APICALL -ctlOverclockResetToDefault( - ctl_device_adapter_handle_t hDeviceHandle ///< [in][release] Handle to display adapter - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnOverclockResetToDefault_t pfnOverclockResetToDefault = (ctl_pfnOverclockResetToDefault_t)GetProcAddress(hinstLibPtr, "ctlOverclockResetToDefault"); - if (pfnOverclockResetToDefault) - { - result = pfnOverclockResetToDefault(hDeviceHandle); - } - } - - return result; -} - - -/** -* @brief Get PCI properties - address, max speed -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -*/ -ctl_result_t CTL_APICALL -ctlPciGetProperties( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPciGetProperties_t pfnPciGetProperties = (ctl_pfnPciGetProperties_t)GetProcAddress(hinstLibPtr, "ctlPciGetProperties"); - if (pfnPciGetProperties) - { - result = pfnPciGetProperties(hDAhandle, pProperties); - } - } - - return result; -} - - -/** -* @brief Get current PCI state - current speed -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pState` -*/ -ctl_result_t CTL_APICALL -ctlPciGetState( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - ctl_pci_state_t* pState ///< [in,out] Will contain the PCI properties. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPciGetState_t pfnPciGetState = (ctl_pfnPciGetState_t)GetProcAddress(hinstLibPtr, "ctlPciGetState"); - if (pfnPciGetState) - { - result = pfnPciGetState(hDAhandle, pState); - } - } - - return result; -} - - -/** -* @brief Get handle of power domains -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -*/ -ctl_result_t CTL_APICALL -ctlEnumPowerDomains( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumPowerDomains_t pfnEnumPowerDomains = (ctl_pfnEnumPowerDomains_t)GetProcAddress(hinstLibPtr, "ctlEnumPowerDomains"); - if (pfnEnumPowerDomains) - { - result = pfnEnumPowerDomains(hDAhandle, pCount, phPower); - } - } - - return result; -} - - -/** -* @brief Get properties related to a power domain -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hPower` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -*/ -ctl_result_t CTL_APICALL -ctlPowerGetProperties( - ctl_pwr_handle_t hPower, ///< [in] Handle for the component. - ctl_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPowerGetProperties_t pfnPowerGetProperties = (ctl_pfnPowerGetProperties_t)GetProcAddress(hinstLibPtr, "ctlPowerGetProperties"); - if (pfnPowerGetProperties) - { - result = pfnPowerGetProperties(hPower, pProperties); - } - } - - return result; -} - - -/** -* @brief Get energy counter -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hPower` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pEnergy` -*/ -ctl_result_t CTL_APICALL -ctlPowerGetEnergyCounter( - ctl_pwr_handle_t hPower, ///< [in] Handle for the component. - ctl_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and - ///< timestamp when the last counter value was measured. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPowerGetEnergyCounter_t pfnPowerGetEnergyCounter = (ctl_pfnPowerGetEnergyCounter_t)GetProcAddress(hinstLibPtr, "ctlPowerGetEnergyCounter"); - if (pfnPowerGetEnergyCounter) - { - result = pfnPowerGetEnergyCounter(hPower, pEnergy); - } - } - - return result; -} - - -/** -* @brief Get power limits -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hPower` -*/ -ctl_result_t CTL_APICALL -ctlPowerGetLimits( - ctl_pwr_handle_t hPower, ///< [in] Handle for the component. - ctl_power_limits_t* pPowerLimits ///< [in,out][optional] Structure that will contain the power limits. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPowerGetLimits_t pfnPowerGetLimits = (ctl_pfnPowerGetLimits_t)GetProcAddress(hinstLibPtr, "ctlPowerGetLimits"); - if (pfnPowerGetLimits) - { - result = pfnPowerGetLimits(hPower, pPowerLimits); - } - } - - return result; -} - - -/** -* @brief Set power limits -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hPower` -* - ::CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS -* + User does not have permissions to make these modifications. -* - ::CTL_RESULT_ERROR_NOT_AVAILABLE -* + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. -*/ -ctl_result_t CTL_APICALL -ctlPowerSetLimits( - ctl_pwr_handle_t hPower, ///< [in] Handle for the component. - const ctl_power_limits_t* pPowerLimits ///< [in][optional] Structure that will contain the power limits. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnPowerSetLimits_t pfnPowerSetLimits = (ctl_pfnPowerSetLimits_t)GetProcAddress(hinstLibPtr, "ctlPowerSetLimits"); - if (pfnPowerSetLimits) - { - result = pfnPowerSetLimits(hPower, pPowerLimits); - } - } - - return result; -} - - -/** -* @brief Get handle of temperature sensors -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hDAhandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -*/ -ctl_result_t CTL_APICALL -ctlEnumTemperatureSensors( - ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter - uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. - ///< if count is zero, then the driver shall update the value with the - ///< total number of components of this type that are available. - ///< if count is greater than the number of components of this type that - ///< are available, then the driver shall update the value with the correct - ///< number of components. - ctl_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of - ///< this type. - ///< if count is less than the number of components of this type that are - ///< available, then the driver shall only retrieve that number of - ///< component handles. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumTemperatureSensors_t pfnEnumTemperatureSensors = (ctl_pfnEnumTemperatureSensors_t)GetProcAddress(hinstLibPtr, "ctlEnumTemperatureSensors"); - if (pfnEnumTemperatureSensors) - { - result = pfnEnumTemperatureSensors(hDAhandle, pCount, phTemperature); - } - } - - return result; -} - - -/** -* @brief Get temperature sensor properties -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hTemperature` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pProperties` -*/ -ctl_result_t CTL_APICALL -ctlTemperatureGetProperties( - ctl_temp_handle_t hTemperature, ///< [in] Handle for the component. - ctl_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnTemperatureGetProperties_t pfnTemperatureGetProperties = (ctl_pfnTemperatureGetProperties_t)GetProcAddress(hinstLibPtr, "ctlTemperatureGetProperties"); - if (pfnTemperatureGetProperties) - { - result = pfnTemperatureGetProperties(hTemperature, pProperties); - } - } - - return result; -} - - -/** -* @brief Get the temperature from a specified sensor -* -* @details -* - The application may call this function from simultaneous threads. -* - The implementation of this function should be lock-free. -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hTemperature` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pTemperature` -*/ -ctl_result_t CTL_APICALL -ctlTemperatureGetState( - ctl_temp_handle_t hTemperature, ///< [in] Handle for the component. - double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor - ///< in degrees Celsius. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnTemperatureGetState_t pfnTemperatureGetState = (ctl_pfnTemperatureGetState_t)GetProcAddress(hinstLibPtr, "ctlTemperatureGetState"); - if (pfnTemperatureGetState) - { - result = pfnTemperatureGetState(hTemperature, pTemperature); - } - } - - return result; -} - - -// -// End of wrapper function implementation -// -///////////////////////////////////////////////////////////////////////////////// From d2f9034d7e0c5a445a9d76d0bcba9c5c02338d6d Mon Sep 17 00:00:00 2001 From: Robert Dower Date: Fri, 3 May 2024 14:40:44 -0700 Subject: [PATCH 07/26] add required SECURITY.md file for OSSF Scorecard compliance --- SECURITY.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..373608b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,5 @@ +# Security Policy +Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation. + +## Reporting a Vulnerability +Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html). From 65f5c432a16f837146cc2a3588fc737880dff66f Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Wed, 15 May 2024 09:22:20 +0530 Subject: [PATCH 08/26] Updated version to v196 --- Samples/Generic_Sample/Sample_ControlAPP.cpp | 6 ++---- Samples/Overclocking_Sample/Sample_OverclockAPP.cpp | 9 ++++++++- Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp | 9 ++++++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Samples/Generic_Sample/Sample_ControlAPP.cpp b/Samples/Generic_Sample/Sample_ControlAPP.cpp index dc5f8cf..583c246 100644 --- a/Samples/Generic_Sample/Sample_ControlAPP.cpp +++ b/Samples/Generic_Sample/Sample_ControlAPP.cpp @@ -790,14 +790,12 @@ void PrintDetailsFromSysman(ctl_device_adapter_handle_t hDevice) return; } -ctl_result_t CtlAdapterTesting(void) +ctl_result_t CtlAdapterTesting(ctl_device_adapter_handle_t *hDevices, uint32_t Adapter_count) { ctl_result_t Result = CTL_RESULT_SUCCESS; - ctl_device_adapter_handle_t *hDevices = nullptr; ctl_display_output_handle_t *hDisplayOutput = nullptr; ctl_device_adapter_properties_t StDeviceAdapterProperties = { 0 }; - uint32_t Adapter_count = 0; uint32_t Display_count = 0; uint32_t Index = 0; uint32_t Display_index = 0; @@ -1031,7 +1029,7 @@ int main() try { - CtlAdapterTesting(); + CtlAdapterTesting(hDevices, Adapter_count); } catch (const std::ios_base::failure &e) { diff --git a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp index 0e9dd0f..60c3c0e 100644 --- a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp +++ b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp @@ -900,7 +900,14 @@ int main() // Polling during 1 second at 100 ms for (uint32_t i = 0; i < 10; i++) { - OverclockPowerTelemetry(hDevices[Index]); + try + { + OverclockPowerTelemetry(hDevices[Index]); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Sleep(100); } diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index 5b99142..2955290 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -1802,7 +1802,14 @@ int main() // Polling during 1 second at 20 ms for (uint32_t i = 0; i < 50; i++) { - CtlPowerTelemetryTest(hDevices[Index]); + try + { + CtlPowerTelemetryTest(hDevices[Index]); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } Sleep(20); } From 029cb0f4ff0c9024a6df0fc87c514ce51d5dd835 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Thu, 20 Jun 2024 16:42:56 +0530 Subject: [PATCH 09/26] Updated version to v200 --- .../Panel_descriptor_Sample_App.cpp | 22 +++++++++++++------ .../Telemetry_Samples/Sample_TelemetryAPP.cpp | 6 +++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp b/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp index 5fbbe31..97eb1a3 100644 --- a/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp +++ b/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp @@ -58,10 +58,14 @@ ctl_result_t GetPanelDescriptor(ctl_display_output_handle_t hDisplayOutput, ctl_ Result = ctlPanelDescriptorAccess(hDisplayOutput, pPanelDescArgs); LOG_AND_EXIT_ON_ERROR(Result, "ctlPanelDescriptorAccess"); - printf("Panel Descriptor Data: \n"); - for (uint32_t j = 0; j < pPanelDescArgs->DescriptorDataSize; j++) + printf("Panel Descriptor Data on block %d: \n", pPanelDescArgs->BlockNumber); + for (uint32_t i = 0; i < pPanelDescArgs->DescriptorDataSize; i += 16) { - printf("[%d] = : 0x%X\n", j, pPanelDescArgs->pDescriptorData[j]); + for (uint32_t j = i; j < (i + 16); j++) + { + printf("0x%02X ", pPanelDescArgs->pDescriptorData[j]); + } + printf("\n"); } // EXTENSION BLOCKS READ : For EDID, Need to get the number of extensions blocks from 127th byte of base block @@ -97,7 +101,7 @@ ctl_result_t GetPanelDescriptor(ctl_display_output_handle_t hDisplayOutput, ctl_ ExtBlockPanelDescArgs = { 0 }; ExtBlockPanelDescArgs.Size = sizeof(ctl_panel_descriptor_access_args_t); ExtBlockPanelDescArgs.OpType = CTL_OPERATION_TYPE_READ; // Currently only Read operation is supported. Write operationnot supported. - ExtBlockPanelDescArgs.BlockNumber = BlockIndex; // Block number + ExtBlockPanelDescArgs.BlockNumber = BlockIndex + 1; // Block number ExtBlockPanelDescArgs.DescriptorDataSize = ExtBlockDescriptorDataSize; ExtBlockPanelDescArgs.pDescriptorData = (uint8_t *)malloc(ExtBlockDescriptorDataSize * sizeof(uint8_t)); // Allocate memory for the descriptor data @@ -112,10 +116,14 @@ ctl_result_t GetPanelDescriptor(ctl_display_output_handle_t hDisplayOutput, ctl_ goto Exit; } - printf("Panel Descriptor Data: \n"); - for (uint32_t j = 0; j < pPanelDescArgs->DescriptorDataSize; j++) + printf("Panel Descriptor Data on block %d: \n", ExtBlockPanelDescArgs.BlockNumber); + for (uint32_t i = 0; i < pPanelDescArgs->DescriptorDataSize; i += 16) { - printf("[%d] = : 0x%X\n", j, ExtBlockPanelDescArgs.pDescriptorData[j]); + for (uint32_t j = i; j < (i + 16); j++) + { + printf("0x%02X ", ExtBlockPanelDescArgs.pDescriptorData[j]); + } + printf("\n"); } CTL_FREE_MEM(ExtBlockPanelDescArgs.pDescriptorData); diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index 2955290..6476f50 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -1566,6 +1566,12 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentTemperature.type)); PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramCurrentTemperature.value.datadouble); + PRINT_LOGS("\nTotal Card Energy Counter:"); + PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.totalCardEnergyCounter.bSupported) ? "true" : "false")); + PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.totalCardEnergyCounter.units)); + PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.totalCardEnergyCounter.type)); + PRINT_LOGS("\nValue: %f", pPowerTelemetry.totalCardEnergyCounter.value.datadouble); + PRINT_LOGS("\nFan Speeds:"); for (uint32_t i = 0; i < CTL_FAN_COUNT; i++) { From 0874942cd2feb15fdd613c80f55ce2125ef40d92 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Tue, 16 Jul 2024 20:46:36 +0530 Subject: [PATCH 10/26] Updated version to v202 --- Samples/CombinedDisplay/Disable.cfg | 17 +++++++++++++++++ Samples/CombinedDisplay/Enable.cfg | 17 +++++++++++++++++ Samples/CombinedDisplay/Query.cfg | 17 +++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 Samples/CombinedDisplay/Disable.cfg create mode 100644 Samples/CombinedDisplay/Enable.cfg create mode 100644 Samples/CombinedDisplay/Query.cfg diff --git a/Samples/CombinedDisplay/Disable.cfg b/Samples/CombinedDisplay/Disable.cfg new file mode 100644 index 0000000..93d359b --- /dev/null +++ b/Samples/CombinedDisplay/Disable.cfg @@ -0,0 +1,17 @@ +## syntax - OpType and NumOutputs must be placed at first. Configuration item label is case sensitive. + +OpType = 3 # Operation type: 1 -- Is_Supported_Config, 2 -- Enable, 3 -- Disable, 4 -- Query_Config +NumOutputs = 4 # Number of (display) outputs: has to be 2 or greater, maximum is 4. +DisplayOrder = 0,1,2,3 # which displays are involved: 0 indicates the first, 1 indicates the 2nd, and so on. order matters, "1 0" means display 1 will be viewed as first elected and display 0 is will be viewed as 2nd selected. +CombinedDesktopWidth = 3840 # combined display width +CombinedDesktopHeight = 2160 # combined display height + +# ChildInfo = Display Number,{FbSrc},{FbPos},Orientation,{Target Mode} where +# FbSrc = {left,top,right,bottom} +# FbPos = {left,top,right,bottom} +# Display Orientation = 0 (0 rotation), 2 (180 rotation) +# Target Mode = {width, height, refresh} : If 0, this means using native target mode instead of custom mode +ChildInfo = 0,{0,0,1920,1080},{0,0,1920,1080}, 0, {0,0,0} +ChildInfo = 1,{1920,0,3840,1080},{0,0,1920,1080}, 0, {0,0,0} +ChildInfo = 2,{0,1080,1920,2160},{0,0,1920,1080}, 0, {0,0,0} +ChildInfo = 3,{1920,1080,3840,2160},{0,0,1920,1080}, 0, {0,0,0} \ No newline at end of file diff --git a/Samples/CombinedDisplay/Enable.cfg b/Samples/CombinedDisplay/Enable.cfg new file mode 100644 index 0000000..fbf1b88 --- /dev/null +++ b/Samples/CombinedDisplay/Enable.cfg @@ -0,0 +1,17 @@ +## syntax - OpType and NumOutputs must be placed at first. Configuration item label is case sensitive. + +OpType = 2 # Operation type: 1 -- Is_Supported_Config, 2 -- Enable, 3 -- Disable, 4 -- Query_Config +NumOutputs = 2 # Number of (display) outputs: has to be 2 or greater, maximum is 4. +DisplayOrder = 0,1,2,3 # which displays are involved: 0 indicates the first, 1 indicates the 2nd, and so on. order matters, "1 0" means display 1 will be viewed as first elected and display 0 is will be viewed as 2nd selected. +CombinedDesktopWidth = 3840 # combined display width +CombinedDesktopHeight = 1080 # combined display height + +# ChildInfo = Display Number,{FbSrc},{FbPos},Orientation,{Target Mode} where +# FbSrc = {left,top,right,bottom} +# FbPos = {left,top,right,bottom} +# Display Orientation = 0 (0 rotation), 2 (180 rotation) +# Target Mode = {width, height, refresh} : If 0, this means using native target mode instead of custom mode +ChildInfo = 0,{0,0,1920,1080},{0,0,1920,1080}, 0, {0,0,0} +ChildInfo = 1,{1920,0,3840,1080},{0,0,1920,1080}, 0, {0,0,0} +ChildInfo = 2,{0,1080,1920,2160},{0,0,1920,1080}, 0, {0,0,0} +ChildInfo = 3,{1920,1080,3840,2160},{0,0,1920,1080}, 0, {0,0,0} \ No newline at end of file diff --git a/Samples/CombinedDisplay/Query.cfg b/Samples/CombinedDisplay/Query.cfg new file mode 100644 index 0000000..d3633c4 --- /dev/null +++ b/Samples/CombinedDisplay/Query.cfg @@ -0,0 +1,17 @@ +## syntax - OpType and NumOutputs must be placed at first. Configuration item label is case sensitive. + +OpType = 4 # Operation type: 1 -- Is_Supported_Config, 2 -- Enable, 3 -- Disable, 4 -- Query_Config +NumOutputs = 4 # Number of (display) outputs: has to be 2 or greater, maximum is 4. +DisplayOrder = 0,1,2,3 # which displays are involved: 0 indicates the first, 1 indicates the 2nd, and so on. order matters, "1 0" means display 1 will be viewed as first elected and display 0 is will be viewed as 2nd selected. +CombinedDesktopWidth = 3840 # combined display width +CombinedDesktopHeight = 2160 # combined display height + +# ChildInfo = Display Number,{FbSrc},{FbPos},Orientation,{Target Mode} where +# FbSrc = {left,top,right,bottom} +# FbPos = {left,top,right,bottom} +# Display Orientation = 0 (0 rotation), 2 (180 rotation) +# Target Mode = {width, height, refresh} : If 0, this means using native target mode instead of custom mode +ChildInfo = 0,{0,0,1920,1080},{0,0,1920,1080}, 0, {0,0,0} +ChildInfo = 1,{1920,0,3840,1080},{0,0,1920,1080}, 0, {0,0,0} +ChildInfo = 2,{0,1080,1920,2160},{0,0,1920,1080}, 0, {0,0,0} +ChildInfo = 3,{1920,1080,3840,2160},{0,0,1920,1080}, 0, {0,0,0} \ No newline at end of file From cafcc9fc0dcc3594e085c3058a0e830fcafd3de3 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Mon, 26 Aug 2024 19:56:59 +0530 Subject: [PATCH 11/26] Updated version to v207 --- Samples/Generic_Sample/Sample_ControlAPP.cpp | 2 +- include/igcl_api.h | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Samples/Generic_Sample/Sample_ControlAPP.cpp b/Samples/Generic_Sample/Sample_ControlAPP.cpp index 583c246..107414b 100644 --- a/Samples/Generic_Sample/Sample_ControlAPP.cpp +++ b/Samples/Generic_Sample/Sample_ControlAPP.cpp @@ -359,7 +359,7 @@ ctl_result_t CtlGet3DGlobalTest(ctl_device_adapter_handle_t hDevices) { if (false == Get3DCustomStruct(&Feature3D)) { - assert(0); + printf("A new custom feature was added which is not known to the driver\n"); continue; // some error, continue with next value } } diff --git a/include/igcl_api.h b/include/igcl_api.h index 0b2d02f..c649340 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -5101,14 +5101,17 @@ typedef struct _ctl_freq_range_t uint8_t Version; ///< [in] version of this structure double min; ///< [in,out] The min frequency in MHz below which hardware frequency ///< management will not request frequencies. On input, setting to 0 will - ///< permit the frequency to go down to the hardware minimum. On output, a - ///< negative value indicates that no external minimum frequency limit is - ///< in effect. + ///< permit the frequency to go down to the hardware minimum while setting + ///< to -1 will return the min frequency limit to the factory value (can be + ///< larger than the hardware min). On output, a negative value indicates + ///< that no external minimum frequency limit is in effect. double max; ///< [in,out] The max frequency in MHz above which hardware frequency ///< management will not request frequencies. On input, setting to 0 or a ///< very big number will permit the frequency to go all the way up to the - ///< hardware maximum. On output, a negative number indicates that no - ///< external maximum frequency limit is in effect. + ///< hardware maximum while setting to -1 will return the max frequency to + ///< the factory value (which can be less than the hardware max). On + ///< output, a negative number indicates that no external maximum frequency + ///< limit is in effect. } ctl_freq_range_t; From ba54e3070cc3e3492f604e1510a9d58bf1c384e2 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Thu, 3 Oct 2024 08:55:46 +0530 Subject: [PATCH 12/26] Updated version to v210 --- Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp | 12 +++++++++++- Samples/inc/GenericIGCLApp.h | 2 ++ include/igcl_api.h | 13 +++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index 6476f50..62c12f4 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -322,7 +322,10 @@ void CtlFrequencyTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\n[Frequency] Min [%f]] MHz", freqProperties.min); PRINT_LOGS("\n[Frequency] Max [%f]] MHz", freqProperties.max); PRINT_LOGS("\n[Frequency] Can Control Frequency? [%u]]", (uint32_t)freqProperties.canControl); - PRINT_LOGS("\n[Frequency] Frequency Domain [%s]]", ((freqProperties.type == CTL_FREQ_DOMAIN_GPU) ? "GPU" : "MEMORY")); + PRINT_LOGS("\n[Frequency] Frequency Domain [%s]]", ((freqProperties.type == CTL_FREQ_DOMAIN_GPU) ? "GPU" : + (freqProperties.type == CTL_FREQ_DOMAIN_MEMORY) ? "MEMORY" : + (freqProperties.type == CTL_FREQ_DOMAIN_MEDIA) ? "MEDIA" : + "Unknown")); } PRINT_LOGS("\n\n[Frequency] State:"); @@ -465,6 +468,7 @@ void CtlPowerTest(ctl_device_adapter_handle_t hDAhandle) else { PRINT_LOGS("\n[Power] Can Control [%u]", (uint32_t)properties.canControl); + PRINT_LOGS("\n[Power] Default Power Limit [%u]", (uint32_t)properties.defaultLimit); PRINT_LOGS("\n[Power] Max Power Limit [%i] mW", properties.maxLimit); PRINT_LOGS("\n[Power] Min Power Limit [%i] mW", properties.minLimit); } @@ -1572,6 +1576,12 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.totalCardEnergyCounter.type)); PRINT_LOGS("\nValue: %f", pPowerTelemetry.totalCardEnergyCounter.value.datadouble); + PRINT_LOGS("\ngpuPowerLimited: %s", ((pPowerTelemetry.gpuPowerLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuTemperatureLimited: %s", ((pPowerTelemetry.gpuTemperatureLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuCurrentLimited: %s", ((pPowerTelemetry.gpuCurrentLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuVoltageLimited: %s", ((pPowerTelemetry.gpuVoltageLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuUtilizationLimited: %s", ((pPowerTelemetry.gpuUtilizationLimited) ? "true" : "false")); + PRINT_LOGS("\nFan Speeds:"); for (uint32_t i = 0; i < CTL_FAN_COUNT; i++) { diff --git a/Samples/inc/GenericIGCLApp.h b/Samples/inc/GenericIGCLApp.h index d286be2..3959326 100644 --- a/Samples/inc/GenericIGCLApp.h +++ b/Samples/inc/GenericIGCLApp.h @@ -109,6 +109,8 @@ inline char *Get3DFeatureName(ctl_3d_feature_t FeatureType) return "VRR windowed blt"; case CTL_3D_FEATURE_GLOBAL_OR_PER_APP: return "global or per app settings"; + case CTL_3D_FEATURE_LOW_LATENCY: + return "Low Latency"; default: return "No Name"; } diff --git a/include/igcl_api.h b/include/igcl_api.h index c649340..7916c87 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -1458,6 +1458,7 @@ typedef enum _ctl_3d_feature_t CTL_3D_FEATURE_EMULATED_TYPED_64BIT_ATOMICS = 13, ///< Emulated Typed 64bit Atomics support in DG2 CTL_3D_FEATURE_VRR_WINDOWED_BLT = 14, ///< VRR windowed blt. Control VRR for windowed mode game CTL_3D_FEATURE_GLOBAL_OR_PER_APP = 15, ///< Set global settings or per application settings + CTL_3D_FEATURE_LOW_LATENCY = 16, ///< Low latency mode. Contains generic enum type fields CTL_3D_FEATURE_MAX } ctl_3d_feature_t; @@ -1533,6 +1534,17 @@ typedef enum _ctl_3d_endurance_gaming_mode_t } ctl_3d_endurance_gaming_mode_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Low latency mode values possible +typedef enum _ctl_3d_low_latency_types_t +{ + CTL_3D_LOW_LATENCY_TYPES_TURN_OFF = 0, ///< Low latency mode disable + CTL_3D_LOW_LATENCY_TYPES_TURN_ON = 1, ///< Low latency mode enable + CTL_3D_LOW_LATENCY_TYPES_TURN_ON_BOOST_MODE_ON = 2, ///< Low latency mode enable with boost + CTL_3D_LOW_LATENCY_TYPES_MAX + +} ctl_3d_low_latency_types_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Cmaa values possible typedef enum _ctl_3d_cmaa_types_t @@ -5071,6 +5083,7 @@ typedef enum _ctl_freq_domain_t { CTL_FREQ_DOMAIN_GPU = 0, ///< GPU Core Domain. CTL_FREQ_DOMAIN_MEMORY = 1, ///< Local Memory Domain. + CTL_FREQ_DOMAIN_MEDIA = 2, ///< Media Domain CTL_FREQ_DOMAIN_MAX } ctl_freq_domain_t; From e2159460681363aaa65702ea3116785400fead75 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Mon, 4 Nov 2024 19:22:21 +0530 Subject: [PATCH 13/26] Updated version to v213 --- .../Edid_Mgmt_Sample_App.cpp | 47 ++-- Source/cApiWrapper.cpp | 181 +++++++++++++++ include/igcl_api.h | 208 ++++++++++++++++++ 3 files changed, 414 insertions(+), 22 deletions(-) diff --git a/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp b/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp index d50d0b6..ea42333 100644 --- a/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp +++ b/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp @@ -43,16 +43,17 @@ static bool WriteBinaryFile = false; static bool DisableAudioInEdid = false; static char EdidBinFileName[MAX_PATH] = { 0 }; -static uint8_t EdidOverrideBuf[] = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0xAC, 0x16, 0xF0, 0x4C, 0x4E, 0x37, 0x30, 0x17, 0x15, 0x01, 0x03, 0x80, 0x34, 0x20, 0x78, 0xEA, 0x1E, - 0xC5, 0xAE, 0x4F, 0x34, 0xB1, 0x26, 0x0E, 0x50, 0x54, 0xA5, 0x4B, 0x00, 0x81, 0x80, 0xA9, 0x40, 0xD1, 0x00, 0x71, 0x4F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x28, 0x3C, 0x80, 0xA0, 0x70, 0xB0, 0x23, 0x40, 0x30, 0x20, 0x36, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x4A, - 0x32, 0x35, 0x37, 0x4D, 0x31, 0x36, 0x31, 0x30, 0x37, 0x4E, 0x4C, 0x0A, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x49, 0x47, 0x43, 0x4C, 0x20, 0x44, 0x45, 0x4C, 0x55, - 0x32, 0x34, 0x31, 0x30, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x38, 0x4C, 0x1E, 0x51, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0xEC, 0x02, 0x03, - 0x29, 0xF1, 0x50, 0x90, 0x05, 0x04, 0x03, 0x02, 0x07, 0x16, 0x01, 0x1F, 0x12, 0x13, 0x14, 0x20, 0x15, 0x11, 0x06, 0x23, 0x09, 0x07, 0x07, 0x67, 0x03, 0x0C, - 0x00, 0x10, 0x00, 0x38, 0x2D, 0x83, 0x01, 0x00, 0x00, 0xE3, 0x05, 0x03, 0x01, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, 0x45, 0x00, 0x06, - 0x44, 0x21, 0x00, 0x00, 0x1E, 0x01, 0x1D, 0x80, 0x18, 0x71, 0x1C, 0x16, 0x20, 0x58, 0x2C, 0x25, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x9E, 0x01, 0x1D, 0x00, - 0x72, 0x51, 0xD0, 0x1E, 0x20, 0x6E, 0x28, 0x55, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x1E, 0x8C, 0x0A, 0xD0, 0x8A, 0x20, 0xE0, 0x2D, 0x10, 0x10, 0x3E, 0x96, - 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E }; +// declare a size variable vector instead of fixed size array, such that, we can recieve variant blocks of EDID +static std::vector EdidOverrideBuf = { + 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x10, 0xAC, 0x16, 0xF0, 0x4C, 0x4E, 0x37, 0x30, 0x17, 0x15, 0x01, 0x03, 0x80, 0x34, 0x20, 0x78, 0xEA, 0x1E, 0xC5, 0xAE, 0x4F, 0x34, 0xB1, 0x26, + 0x0E, 0x50, 0x54, 0xA5, 0x4B, 0x00, 0x81, 0x80, 0xA9, 0x40, 0xD1, 0x00, 0x71, 0x4F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x28, 0x3C, 0x80, 0xA0, 0x70, 0xB0, 0x23, 0x40, 0x30, 0x20, + 0x36, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x4A, 0x32, 0x35, 0x37, 0x4D, 0x31, 0x36, 0x31, 0x30, 0x37, 0x4E, 0x4C, 0x0A, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x49, + 0x47, 0x43, 0x4C, 0x20, 0x44, 0x45, 0x4C, 0x55, 0x32, 0x34, 0x31, 0x30, 0x00, 0x00, 0x00, 0xFD, 0x00, 0x38, 0x4C, 0x1E, 0x51, 0x11, 0x00, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x01, 0xEC, + 0x02, 0x03, 0x29, 0xF1, 0x50, 0x90, 0x05, 0x04, 0x03, 0x02, 0x07, 0x16, 0x01, 0x1F, 0x12, 0x13, 0x14, 0x20, 0x15, 0x11, 0x06, 0x23, 0x09, 0x07, 0x07, 0x67, 0x03, 0x0C, 0x00, 0x10, 0x00, 0x38, + 0x2D, 0x83, 0x01, 0x00, 0x00, 0xE3, 0x05, 0x03, 0x01, 0x02, 0x3A, 0x80, 0x18, 0x71, 0x38, 0x2D, 0x40, 0x58, 0x2C, 0x45, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x1E, 0x01, 0x1D, 0x80, 0x18, 0x71, + 0x1C, 0x16, 0x20, 0x58, 0x2C, 0x25, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x9E, 0x01, 0x1D, 0x00, 0x72, 0x51, 0xD0, 0x1E, 0x20, 0x6E, 0x28, 0x55, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x1E, 0x8C, + 0x0A, 0xD0, 0x8A, 0x20, 0xE0, 0x2D, 0x10, 0x10, 0x3E, 0x96, 0x00, 0x06, 0x44, 0x21, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E +}; /*************************************************************** * @brief PrintUsage @@ -360,8 +361,8 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ } else { - EdidSize = sizeof(EdidOverrideBuf); - Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, EdidOverrideBuf); + EdidSize = static_cast(EdidOverrideBuf.size()); + Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, &EdidOverrideBuf[0]); } LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:LOCK supplied EDID"); printf("Info: Passed Test Lock supplied EDID.\n"); @@ -372,8 +373,8 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ printf("Info: Passed Test Unlock EDID.\n"); break; case CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID: - EdidSize = sizeof(EdidOverrideBuf); - Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, EdidOverrideBuf); + EdidSize = static_cast(EdidOverrideBuf.size()); + Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, &EdidOverrideBuf[0]); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:override EDID"); printf("Info: Passed Test override EDID.\n"); break; @@ -404,8 +405,8 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ { if (true == IsCustomEdid) { - EdidSize = sizeof(EdidOverrideBuf); - Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, EdidOverrideBuf); + EdidSize = static_cast(EdidOverrideBuf.size()); + Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, &EdidOverrideBuf[0]); } else { @@ -424,8 +425,8 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ if (CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID == EdidMgmtOpType || CTL_EDID_MANAGEMENT_OPTYPE_MAX == EdidMgmtOpType) { - EdidSize = sizeof(EdidOverrideBuf); - Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, EdidOverrideBuf); + EdidSize = static_cast(EdidOverrideBuf.size()); + Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, &EdidOverrideBuf[0]); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:override EDID"); printf("Info: Passed Test override EDID.\n"); } @@ -469,8 +470,8 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ // test EDID lock with Supplied EDID. For demo purpose. if (CTL_EDID_MANAGEMENT_OPTYPE_MAX == EdidMgmtOpType) { - EdidSize = sizeof(EdidOverrideBuf); - Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, EdidOverrideBuf); + EdidSize = static_cast(EdidOverrideBuf.size()); + Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, &EdidOverrideBuf[0]); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:LOCK supplied EDID"); printf("Info: Passed Test Lock supplied EDID.\n"); @@ -779,9 +780,11 @@ int main(int32_t Argc, char *pArgv[]) } FileSize = EdidFile.tellg(); - ZeroMemory(&EdidOverrideBuf, sizeof(EdidOverrideBuf)); + // resize the buffer to recive data read from file + EdidOverrideBuf.clear(); + EdidOverrideBuf.resize(static_cast(FileSize)); EdidFile.seekg(0, ios::beg); - EdidFile.read((char *)&EdidOverrideBuf, FileSize); + EdidFile.read((char *)&EdidOverrideBuf[0], FileSize); EdidFile.close(); IsCustomEdid = true; } diff --git a/Source/cApiWrapper.cpp b/Source/cApiWrapper.cpp index c881441..9723b25 100644 --- a/Source/cApiWrapper.cpp +++ b/Source/cApiWrapper.cpp @@ -3261,6 +3261,187 @@ ctlFrequencyGetThrottleTime( } +/** +* @brief Get handle of Leds +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +*/ +ctl_result_t CTL_APICALL +ctlEnumLeds( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< If count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< If count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< If count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumLeds_t pfnEnumLeds = (ctl_pfnEnumLeds_t)GetProcAddress(hinstLibPtr, "ctlEnumLeds"); + if (pfnEnumLeds) + { + result = pfnEnumLeds(hDAhandle, pCount, phLed); + } + } + + return result; +} + + +/** +* @brief Get Led properties +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hLed` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +*/ +ctl_result_t CTL_APICALL +ctlLedGetProperties( + ctl_led_handle_t hLed, ///< [in] Handle for the component. + ctl_led_properties_t* pProperties ///< [in,out] Will contain Led properties. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnLedGetProperties_t pfnLedGetProperties = (ctl_pfnLedGetProperties_t)GetProcAddress(hinstLibPtr, "ctlLedGetProperties"); + if (pfnLedGetProperties) + { + result = pfnLedGetProperties(hLed, pProperties); + } + } + + return result; +} + + +/** +* @brief Get Led state +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hLed` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pState` +*/ +ctl_result_t CTL_APICALL +ctlLedGetState( + ctl_led_handle_t hLed, ///< [in] Handle for the component. + ctl_led_state_t* pState ///< [in,out] Will contain the current Led state. + ///< Returns Led state if canControl is true and isI2C is false. + ///< pwm and color structure members of ::ctl_led_state_t will be returned + ///< only if supported by Led, else they will be returned as 0. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnLedGetState_t pfnLedGetState = (ctl_pfnLedGetState_t)GetProcAddress(hinstLibPtr, "ctlLedGetState"); + if (pfnLedGetState) + { + result = pfnLedGetState(hLed, pState); + } + } + + return result; +} + + +/** +* @brief Set Led state +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hLed` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pBuffer` +*/ +ctl_result_t CTL_APICALL +ctlLedSetState( + ctl_led_handle_t hLed, ///< [in] Handle for the component. + void* pBuffer, ///< [in] Led State buffer. + ///< If isI2C is true, the pBuffer and bufferSize will be passed to the I2C + ///< Interface. pBuffer format in this case is OEM defined. + ///< If isI2C is false, the pBuffer will be typecasted to + ///< ::ctl_led_state_t* and bufferSize needs to be sizeof + ///< ::ctl_led_state_t. pwm and color structure members of + ///< ::ctl_led_state_t will be set only if supported by Led, else they will + ///< be ignored. + uint32_t bufferSize ///< [in] Led State buffer size. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnLedSetState_t pfnLedSetState = (ctl_pfnLedSetState_t)GetProcAddress(hinstLibPtr, "ctlLedSetState"); + if (pfnLedSetState) + { + result = pfnLedSetState(hLed, pBuffer, bufferSize); + } + } + + return result; +} + + /** * @brief Get Video Processing capabilities * diff --git a/include/igcl_api.h b/include/igcl_api.h index 7916c87..19da9f9 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -144,6 +144,10 @@ typedef struct _ctl_temp_handle_t *ctl_temp_handle_t; /// @brief Handle for a device frequency domain typedef struct _ctl_freq_handle_t *ctl_freq_handle_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle for a device led +typedef struct _ctl_led_handle_t *ctl_led_handle_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of a power device. typedef struct _ctl_pwr_handle_t *ctl_pwr_handle_t; @@ -1286,6 +1290,18 @@ typedef struct _ctl_freq_state_t ctl_freq_state_t; /// @brief Forward-declare ctl_freq_throttle_time_t typedef struct _ctl_freq_throttle_time_t ctl_freq_throttle_time_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_led_properties_t +typedef struct _ctl_led_properties_t ctl_led_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_led_color_t +typedef struct _ctl_led_color_t ctl_led_color_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_led_state_t +typedef struct _ctl_led_state_t ctl_led_state_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ctl_video_processing_super_resolution_info_t typedef struct _ctl_video_processing_super_resolution_info_t ctl_video_processing_super_resolution_info_t; @@ -5369,6 +5385,164 @@ ctlFrequencyGetThrottleTime( #if !defined(__GNUC__) #pragma endregion // frequency #endif +// Intel 'ctlApi' for Device Adapter - Led Control +#if !defined(__GNUC__) +#pragma region led +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief Led properties +typedef struct _ctl_led_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool canControl; ///< [out] Indicates if software can control the Led assuming the user has + ///< permissions. + bool isI2C; ///< [out] Indicates support for control via I2C interface. + bool isPWM; ///< [out] Returns a valid value if canControl is true and isI2C is false. + ///< Indicates if the Led is PWM capable. If isPWM is false, only turn Led + ///< on/off is supported. + bool haveRGB; ///< [out] Returns a valid value if canControl is true and isI2C is false. + ///< Indicates if the Led is RGB capable. + +} ctl_led_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Led color +typedef struct _ctl_led_color_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + double red; ///< [in,out][range(0.0, 1.0)] The Led red value. On output, a value less + ///< than 0.0 indicates that the color is not known. + double green; ///< [in,out][range(0.0, 1.0)] The Led green value. On output, a value less + ///< than 0.0 indicates that the color is not known. + double blue; ///< [in,out][range(0.0, 1.0)] The Led blue value. On output, a value less + ///< than 0.0 indicates that the color is not known. + +} ctl_led_color_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Led state +typedef struct _ctl_led_state_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool isOn; ///< [in,out] Indicates if the Led is on or off. + double pwm; ///< [in,out] Led On/Off Ratio, PWM range(0.0, 1.0). A value greater than + ///< 1.0 is capped at 1.0. + ctl_led_color_t color; ///< [in,out] Color of the Led. + +} ctl_led_state_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of Leds +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumLeds( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< If count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< If count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of + ///< this type. + ///< If count is less than the number of components of this type that are + ///< available, then the driver shall only retrieve that number of + ///< component handles. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Led properties +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hLed` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlLedGetProperties( + ctl_led_handle_t hLed, ///< [in] Handle for the component. + ctl_led_properties_t* pProperties ///< [in,out] Will contain Led properties. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get Led state +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hLed` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlLedGetState( + ctl_led_handle_t hLed, ///< [in] Handle for the component. + ctl_led_state_t* pState ///< [in,out] Will contain the current Led state. + ///< Returns Led state if canControl is true and isI2C is false. + ///< pwm and color structure members of ::ctl_led_state_t will be returned + ///< only if supported by Led, else they will be returned as 0. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set Led state +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hLed` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pBuffer` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlLedSetState( + ctl_led_handle_t hLed, ///< [in] Handle for the component. + void* pBuffer, ///< [in] Led State buffer. + ///< If isI2C is true, the pBuffer and bufferSize will be passed to the I2C + ///< Interface. pBuffer format in this case is OEM defined. + ///< If isI2C is false, the pBuffer will be typecasted to + ///< ::ctl_led_state_t* and bufferSize needs to be sizeof + ///< ::ctl_led_state_t. pwm and color structure members of + ///< ::ctl_led_state_t will be set only if supported by Led, else they will + ///< be ignored. + uint32_t bufferSize ///< [in] Led State buffer size. + ); + + +#if !defined(__GNUC__) +#pragma endregion // led +#endif // Intel 'ctlApi' for Device Adapter #if !defined(__GNUC__) #pragma region media @@ -7650,6 +7824,40 @@ typedef ctl_result_t (CTL_APICALL *ctl_pfnFrequencyGetThrottleTime_t)( ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumLeds +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumLeds_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_led_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlLedGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnLedGetProperties_t)( + ctl_led_handle_t, + ctl_led_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlLedGetState +typedef ctl_result_t (CTL_APICALL *ctl_pfnLedGetState_t)( + ctl_led_handle_t, + ctl_led_state_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlLedSetState +typedef ctl_result_t (CTL_APICALL *ctl_pfnLedSetState_t)( + ctl_led_handle_t, + void*, + uint32_t + ); + + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for ctlGetSupportedVideoProcessingCapabilities typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSupportedVideoProcessingCapabilities_t)( From b913983a6f49809a8793216fdf786b2a224f75ae Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Thu, 21 Nov 2024 12:23:45 +0530 Subject: [PATCH 14/26] Updated version to v221 --- .../CombinedDisplay_Sample_App.cpp | 5 +- .../Sample_OverclockAPP.cpp | 12 +- .../Telemetry_Samples/Sample_TelemetryAPP.cpp | 154 +++++++----------- include/igcl_api.h | 12 +- 4 files changed, 73 insertions(+), 110 deletions(-) diff --git a/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp b/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp index 643bdd6..b7846fb 100644 --- a/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp +++ b/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp @@ -539,8 +539,9 @@ ctl_result_t TestCombinedDisplay(uint32_t AdapterCount, ctl_device_adapter_handl pHCombinedDisplayOutputs[CombinedDisplayCount++] = pHDisplayOutput[i]; } - uint32_t CombinedAllowedEncoderTypes = CTL_ENCODER_CONFIG_FLAG_TYPEC_CAPABLE | CTL_ENCODER_CONFIG_FLAG_TBT_CAPABLE | CTL_ENCODER_CONFIG_FLAG_DITHERING_SUPPORTED; - bool IsCombinedAvailable = false; + uint32_t CombinedAllowedEncoderTypes = + CTL_ENCODER_CONFIG_FLAG_TYPEC_CAPABLE | CTL_ENCODER_CONFIG_FLAG_TBT_CAPABLE | CTL_ENCODER_CONFIG_FLAG_DITHERING_SUPPORTED | CTL_ENCODER_CONFIG_FLAG_INTERNAL_DISPLAY; + bool IsCombinedAvailable = false; IsCombinedAvailable = (0 == stDisplayEncoderProperties.EncoderConfigFlags) || (stDisplayEncoderProperties.EncoderConfigFlags & CombinedAllowedEncoderTypes); IsDisplayActive = stDisplayProperties.DisplayConfigFlags & CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ACTIVE; diff --git a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp index 60c3c0e..8a2d9f6 100644 --- a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp +++ b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp @@ -188,6 +188,10 @@ const char *printUnits(ctl_units_t Units) { return "Voltage in MilliVolts"; } + case ctl_units_t::CTL_UNITS_BANDWIDTH_MBPS: + { + return "Bandwidth in MegaBytes Per Second"; + } break; default: return "Unknown units"; @@ -739,17 +743,17 @@ void OverclockPowerTelemetry(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentEffectiveFrequency.type)); PRINT_LOGS("\nValue: %f \n", pPowerTelemetry.vramCurrentEffectiveFrequency.value.datadouble); - PRINT_LOGS("\nVRAM Read Bandwidth:"); + PRINT_LOGS("\nVRAM Read Bandwidth Counter:"); PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramReadBandwidthCounter.bSupported) ? "true" : "false"); PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramReadBandwidthCounter.units)); PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramReadBandwidthCounter.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.vramReadBandwidthCounter.value.datadouble); + PRINT_LOGS("\nValue: %llu\n", pPowerTelemetry.vramReadBandwidthCounter.value.datau64); - PRINT_LOGS("\nVRAM Write Bandwidth:"); + PRINT_LOGS("\nVRAM Write Bandwidth Counter:"); PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramWriteBandwidthCounter.bSupported) ? "true" : "false"); PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramWriteBandwidthCounter.units)); PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramWriteBandwidthCounter.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.vramWriteBandwidthCounter.value.datadouble); + PRINT_LOGS("\nValue: %llu\n", pPowerTelemetry.vramWriteBandwidthCounter.value.datau64); PRINT_LOGS("\nVRAM Temperature:"); PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramCurrentTemperature.bSupported) ? "true" : "false"); diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index 62c12f4..2ec51dd 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -35,6 +35,7 @@ std::string DecodeRetCode(ctl_result_t Res); void CtlTemperatureTest(ctl_device_adapter_handle_t hDAhandle); void CtlFrequencyTest(ctl_device_adapter_handle_t hDAhandle); void CtlPowerTest(ctl_device_adapter_handle_t hDAhandle); +void CtlFanTest_FanGetConfig(ctl_fan_handle_t hFanHandle); void CtlFanTest(ctl_device_adapter_handle_t hDAhandle); void CtlPciTest(ctl_device_adapter_handle_t hDAhandle); void CtlMemoryTest(ctl_device_adapter_handle_t hDAhandle); @@ -193,6 +194,10 @@ const char *printUnits(ctl_units_t Units) { return "Voltage in MilliVolts"; } + case ctl_units_t::CTL_UNITS_BANDWIDTH_MBPS: + { + return "Bandwidth in MegaBytes Per Second"; + } break; default: return "Unknown units"; @@ -529,6 +534,49 @@ void CtlPowerTest(ctl_device_adapter_handle_t hDAhandle) pPowerHandle = nullptr; } +/*************************************************************** + * @brief + * place_holder_for_Detailed_desc + * @param + * @return + ***************************************************************/ +void CtlFanTest_FanGetConfig(ctl_fan_handle_t hFanHandle) +{ + PRINT_LOGS("\n[Fan] Fan get Config:"); + + ctl_fan_config_t FanConfig = {}; + FanConfig.Size = sizeof(ctl_fan_config_t); + ctl_result_t res = ctlFanGetConfig(hFanHandle, &FanConfig); + + if (res != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\n %s from Fan get Config.", DecodeRetCode(res).c_str()); + } + else + { + PRINT_LOGS("\n[Fan] Fan Config Mode [%u]", FanConfig.mode); + if (CTL_FAN_SPEED_MODE_DEFAULT == FanConfig.mode) + { + PRINT_LOGS("\n[Fan] Fan Config Mode: Default/Stock"); + } + else if (CTL_FAN_SPEED_MODE_FIXED == FanConfig.mode) + { + PRINT_LOGS("\n[Fan] Fan Config Fixed Speed [%u]", FanConfig.speedFixed.speed); + PRINT_LOGS("\n[Fan] Fan Config Fixed Speed Unit [%u]", FanConfig.speedFixed.units); + } + else if (CTL_FAN_SPEED_MODE_TABLE == FanConfig.mode) + { + PRINT_LOGS("\n[Fan] Fan Config Fan Table NumPoints [%u]", FanConfig.speedTable.numPoints); + for (int32_t numPoints = 0; numPoints < FanConfig.speedTable.numPoints; numPoints++) + { + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed Unit [%u]", FanConfig.speedTable.table[numPoints].speed.units); + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed [%u]", FanConfig.speedTable.table[numPoints].speed.speed); + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Temperature [%u]", FanConfig.speedTable.table[numPoints].temperature); + } + } + } +} + /*************************************************************** * @brief * place_holder_for_Detailed_desc @@ -583,35 +631,7 @@ void CtlFanTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\n[Fan] Supported Units [%u]", Fan_properties.supportedUnits); } - PRINT_LOGS("\n[Fan] Fan get Config:"); - - ctl_fan_config_t FanConfig = {}; - FanConfig.Size = sizeof(ctl_fan_config_t); - res = ctlFanGetConfig(pFanHandle[i], &FanConfig); - - if (res != CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\n %s from Fan get Config.", DecodeRetCode(res).c_str()); - } - else - { - PRINT_LOGS("\n[Fan] Fan Config Mode [%u]", FanConfig.mode); - if (CTL_FAN_SPEED_MODE_FIXED == FanConfig.mode) - { - PRINT_LOGS("\n[Fan] Fan Config Fixed Speed [%u]", FanConfig.speedFixed.speed); - PRINT_LOGS("\n[Fan] Fan Config Fixed Speed Unit [%u]", FanConfig.speedFixed.units); - } - else if (CTL_FAN_SPEED_MODE_TABLE == FanConfig.mode) - { - PRINT_LOGS("\n[Fan] Fan Config Fan Table NumPoints [%u]", FanConfig.speedTable.numPoints); - for (int32_t numPoints = 0; numPoints < FanConfig.speedTable.numPoints; numPoints++) - { - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed Unit [%u]", FanConfig.speedTable.table[numPoints].speed.units); - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed [%u]", FanConfig.speedTable.table[numPoints].speed.speed); - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Temperature [%u]", FanConfig.speedTable.table[numPoints].temperature); - } - } - } + CtlFanTest_FanGetConfig(pFanHandle[i]); PRINT_LOGS("\n[Fan] Fan get state:"); @@ -660,39 +680,7 @@ void CtlFanTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\n[Fan] Set Speed Table Mode Success"); } - PRINT_LOGS("\n[Fan] Fan get Config:"); - - FanConfig = {}; - FanConfig.Size = sizeof(ctl_fan_config_t); - res = ctlFanGetConfig(pFanHandle[i], &FanConfig); - - if (res != CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\n %s from Fan get Config.", DecodeRetCode(res).c_str()); - } - else - { - PRINT_LOGS("\n[Fan] Fan Config Mode [%u]", FanConfig.mode); - if (CTL_FAN_SPEED_MODE_DEFAULT == FanConfig.mode) - { - PRINT_LOGS("\n[Fan] Fan Config Mode: Default/Stock"); - } - else if (CTL_FAN_SPEED_MODE_FIXED == FanConfig.mode) - { - PRINT_LOGS("\n[Fan] Fan Config Fixed Speed [%u]", FanConfig.speedFixed.speed); - PRINT_LOGS("\n[Fan] Fan Config Fixed Speed Unit [%u]", FanConfig.speedFixed.units); - } - else if (CTL_FAN_SPEED_MODE_TABLE == FanConfig.mode) - { - PRINT_LOGS("\n[Fan] Fan Config Fan Table NumPoints [%u]", FanConfig.speedTable.numPoints); - for (int32_t numPoints = 0; numPoints < FanConfig.speedTable.numPoints; numPoints++) - { - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed Unit [%u]", FanConfig.speedTable.table[numPoints].speed.units); - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed [%u]", FanConfig.speedTable.table[numPoints].speed.speed); - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Temperature [%u]", FanConfig.speedTable.table[numPoints].temperature); - } - } - } + CtlFanTest_FanGetConfig(pFanHandle[i]); res = ctlFanSetDefaultMode(pFanHandle[i]); if (res != CTL_RESULT_SUCCESS) @@ -704,39 +692,7 @@ void CtlFanTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\n[Fan] Set DEFAULT Speed Table Mode Success"); } - PRINT_LOGS("\n[Fan] Fan get Config:"); - - FanConfig = {}; - FanConfig.Size = sizeof(ctl_fan_config_t); - res = ctlFanGetConfig(pFanHandle[i], &FanConfig); - - if (res != CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\n %s from Fan get Config.", DecodeRetCode(res).c_str()); - } - else - { - PRINT_LOGS("\n[Fan] Fan Config Mode [%u]", FanConfig.mode); - if (CTL_FAN_SPEED_MODE_DEFAULT == FanConfig.mode) - { - PRINT_LOGS("\n[Fan] Fan Config Mode: Default/Stock"); - } - else if (CTL_FAN_SPEED_MODE_FIXED == FanConfig.mode) - { - PRINT_LOGS("\n[Fan] Fan Config Fixed Speed [%u]", FanConfig.speedFixed.speed); - PRINT_LOGS("\n[Fan] Fan Config Fixed Speed Unit [%u]", FanConfig.speedFixed.units); - } - else if (CTL_FAN_SPEED_MODE_TABLE == FanConfig.mode) - { - PRINT_LOGS("\n[Fan] Fan Config Fan Table NumPoints [%u]", FanConfig.speedTable.numPoints); - for (int32_t numPoints = 0; numPoints < FanConfig.speedTable.numPoints; numPoints++) - { - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed Unit [%u]", FanConfig.speedTable.table[numPoints].speed.units); - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed [%u]", FanConfig.speedTable.table[numPoints].speed.speed); - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Temperature [%u]", FanConfig.speedTable.table[numPoints].temperature); - } - } - } + CtlFanTest_FanGetConfig(pFanHandle[i]); } cleanUp: @@ -1552,17 +1508,17 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentEffectiveFrequency.type)); PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramCurrentEffectiveFrequency.value.datadouble); - PRINT_LOGS("\nVRAM Read Bandwidth:"); + PRINT_LOGS("\nVRAM Read Bandwidth Counter:"); PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramReadBandwidthCounter.bSupported) ? "true" : "false")); PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramReadBandwidthCounter.units)); PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramReadBandwidthCounter.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramReadBandwidthCounter.value.datadouble); + PRINT_LOGS("\nValue: %llu", pPowerTelemetry.vramReadBandwidthCounter.value.datau64); - PRINT_LOGS("\nVRAM Write Bandwidth:"); + PRINT_LOGS("\nVRAM Write Bandwidth Counter:"); PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramWriteBandwidthCounter.bSupported) ? "true" : "false")); PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramWriteBandwidthCounter.units)); PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramWriteBandwidthCounter.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramWriteBandwidthCounter.value.datadouble); + PRINT_LOGS("\nValue: %llu", pPowerTelemetry.vramWriteBandwidthCounter.value.datau64); PRINT_LOGS("\nVRAM Temperature:"); PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramCurrentTemperature.bSupported) ? "true" : "false")); diff --git a/include/igcl_api.h b/include/igcl_api.h index 19da9f9..1025943 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -480,8 +480,9 @@ typedef enum _ctl_units_t CTL_UNITS_ANGULAR_SPEED_RPM = 9, ///< Type is Angular Speed with units in Revolutions per Minute. CTL_UNITS_POWER_MILLIWATTS = 10, ///< Type is Power with units in MilliWatts. CTL_UNITS_PERCENT = 11, ///< Type is Percentage. - CTL_UNITS_MEM_SPEED_GBPS = 12, ///< Type is Memory Speed in Gigabyte per Seconds (Gbps) + CTL_UNITS_MEM_SPEED_GBPS = 12, ///< Type is Memory Speed in Gigabytes per second (GBps). CTL_UNITS_VOLTAGE_MILLIVOLTS = 13, ///< Type is Voltage with units in milliVolts. + CTL_UNITS_BANDWIDTH_MBPS = 14, ///< Type is Bandwidth in Megabytes per second (MBps). CTL_UNITS_UNKNOWN = 0x4800FFFF, ///< Type of units unknown. CTL_UNITS_MAX @@ -1484,10 +1485,11 @@ typedef enum _ctl_3d_feature_t typedef uint32_t ctl_3d_feature_misc_flags_t; typedef enum _ctl_3d_feature_misc_flag_t { - CTL_3D_FEATURE_MISC_FLAG_DX11 = CTL_BIT(0), ///< Feature supported on DX11 - CTL_3D_FEATURE_MISC_FLAG_DX12 = CTL_BIT(1), ///< Feature supported on DX12 - CTL_3D_FEATURE_MISC_FLAG_VULKAN = CTL_BIT(2), ///< Feature supported on VULKAN - CTL_3D_FEATURE_MISC_FLAG_LIVE_CHANGE = CTL_BIT(3), ///< User can change feature live without restarting the game + CTL_3D_FEATURE_MISC_FLAG_DX9 = CTL_BIT(0), ///< Feature supported on DX9 + CTL_3D_FEATURE_MISC_FLAG_DX11 = CTL_BIT(1), ///< Feature supported on DX11 + CTL_3D_FEATURE_MISC_FLAG_DX12 = CTL_BIT(2), ///< Feature supported on DX12 + CTL_3D_FEATURE_MISC_FLAG_VULKAN = CTL_BIT(3), ///< Feature supported on VULKAN + CTL_3D_FEATURE_MISC_FLAG_LIVE_CHANGE = CTL_BIT(4), ///< User can change feature live without restarting the game CTL_3D_FEATURE_MISC_FLAG_MAX = 0x80000000 } ctl_3d_feature_misc_flag_t; From a3f76f8781c1a159ff2b26eaa01710df71f14e07 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Mon, 3 Feb 2025 11:16:57 -0800 Subject: [PATCH 15/26] Updated version to v225 --- Samples/FirmwareApi/CMakeLists.txt | 22 +++ Samples/FirmwareApi/FirmwareApiApp.cpp | 260 +++++++++++++++++++++++++ Samples/FirmwareApi/README.md | 1 + Source/cApiWrapper.cpp | 196 ++++++++++++++++++- include/igcl_api.h | 238 +++++++++++++++++++++- 5 files changed, 710 insertions(+), 7 deletions(-) create mode 100644 Samples/FirmwareApi/CMakeLists.txt create mode 100644 Samples/FirmwareApi/FirmwareApiApp.cpp create mode 100644 Samples/FirmwareApi/README.md diff --git a/Samples/FirmwareApi/CMakeLists.txt b/Samples/FirmwareApi/CMakeLists.txt new file mode 100644 index 0000000..7e9f7fb --- /dev/null +++ b/Samples/FirmwareApi/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +set(TARGET_NAME FirmwareApi) +get_filename_component(ROOT_DIR ../../ ABSOLUTE) +project(FirmwareApi VERSION 1.0) +add_executable(${TARGET_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/FirmwareApiApp.cpp + ${ROOT_DIR}/Source/cApiWrapper.cpp +) + +if(MSVC) + set_target_properties(${TARGET_NAME} + PROPERTIES + VS_DEBUGGER_COMMAND_ARGUMENTS "" + VS_DEBUGGER_WORKING_DIRECTORY "$(OutDir)" + ) + + ADD_DEFINITIONS(-DUNICODE) + ADD_DEFINITIONS(-D_UNICODE) +endif() + +include_directories(${ROOT_DIR}/include) +include_directories(${ROOT_DIR}/Samples/inc) \ No newline at end of file diff --git a/Samples/FirmwareApi/FirmwareApiApp.cpp b/Samples/FirmwareApi/FirmwareApiApp.cpp new file mode 100644 index 0000000..a87cfdd --- /dev/null +++ b/Samples/FirmwareApi/FirmwareApiApp.cpp @@ -0,0 +1,260 @@ +//=========================================================================== +// Copyright (C) 2022 Intel Corporation +// +// +// +// SPDX-License-Identifier: MIT +//-------------------------------------------------------------------------- + +/** + * + * @file FirmwareApiApp.cpp + * @brief This file contains the I2C AUX Sample App & the 'main' function. Program execution begins and ends there. + * + */ + +#define _CRTDBG_MAP_ALLOC +#include +#include +#include +#include +#include +#include + +#define CTL_APIEXPORT // caller of control API DLL shall define this before + // including igcl_api.h +#include "igcl_api.h" +#include "GenericIGCLApp.h" + +ctl_result_t IsDiscreteGfxAdapter(ctl_device_adapter_properties_t *pDeviceAdapterProperties) +{ + if (CTL_DEVICE_TYPE_GRAPHICS != pDeviceAdapterProperties->device_type) + { + printf("This is not a Graphics device \n"); + return CTL_RESULT_ERROR_NOT_INITIALIZED; + } + if (0 != pDeviceAdapterProperties->graphics_adapter_properties) + { + printf("This is not a Discrete Graphics adapter, its either integrated/LDA adapter \n"); + return CTL_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + return CTL_RESULT_SUCCESS; +} + +int main() +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + uint32_t AdapterCount = 0; + ctl_device_adapter_handle_t *hDevices = nullptr; + ctl_device_adapter_properties_t DeviceAdapterProperties[4] = { 0 }; + LUID DeviceID[4] = { 0 }; + + // Get a handle to the DLL module. + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + + ctl_init_args_t CtlInitArgs; + ctl_api_handle_t hAPIHandle; + CtlInitArgs.AppVersion = CTL_MAKE_VERSION(CTL_IMPL_MAJOR_VERSION, CTL_IMPL_MINOR_VERSION); + CtlInitArgs.flags = CTL_INIT_FLAG_USE_LEVEL_ZERO; + CtlInitArgs.Size = sizeof(CtlInitArgs); + CtlInitArgs.Version = 0; + + ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); + + try + { + Result = ctlInit(&CtlInitArgs, &hAPIHandle); + LOG_AND_EXIT_ON_ERROR(Result, "ctlInit"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + + if (CTL_RESULT_SUCCESS != Result) + { + goto Exit; + } + + AdapterCount = 0; + + // Initialization successful + // Get the list of Intel Adapters + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, NULL); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + + if (CTL_RESULT_SUCCESS == Result) + { + hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); + if (nullptr == hDevices) + { + Result = CTL_RESULT_ERROR_INVALID_NULL_POINTER; + goto Exit; + } + + try + { + Result = ctlEnumerateDevices(hAPIHandle, &AdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } + } + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlEnumerateDevices returned failure code: 0x%X\n", Result); + goto Exit; + } + + try + { + for (uint32_t i = 0; i < AdapterCount; i++) + { + DeviceAdapterProperties[i].Size = sizeof(ctl_device_adapter_properties_t); + DeviceAdapterProperties[i].pDeviceID = &(DeviceID[i]); + DeviceAdapterProperties[i].device_id_size = sizeof(LUID); + if (NULL == DeviceAdapterProperties[i].pDeviceID) + { + Result = CTL_RESULT_ERROR_INVALID_NULL_POINTER; + goto Exit; + } + + Result = ctlGetDeviceProperties(hDevices[i], &DeviceAdapterProperties[i]); + if (Result != CTL_RESULT_SUCCESS) + { + printf("ctlGetDeviceProperties returned failure code: 0x%X\n", Result); + continue; + } + + Result = IsDiscreteGfxAdapter(&DeviceAdapterProperties[i]); + if (Result != CTL_RESULT_SUCCESS) + { + continue; + } + + // Get PCI paramters to check link speed + ctl_pci_properties_t PciProperties = { 0 }; + PciProperties.Size = sizeof(PciProperties); + ctl_result_t res = ctlPciGetProperties(hDevices[i], &PciProperties); + if (res != CTL_RESULT_SUCCESS) + { + printf("Error: %d from PCI get properties.", res); + continue; + } + + // Get PCI paramters to check current link speed + ctl_pci_state_t PciState = { 0 }; + PciState.Size = sizeof(PciState); + + res = ctlPciGetState(hDevices[i], &PciState); + if (res != CTL_RESULT_SUCCESS) + { + printf("Error: %d from PCI get properties.", res); + continue; + } + + printf("PCI Max link speed: %d :: PCI Current link speed: %d \n", PciProperties.maxSpeed.gen, PciState.speed.gen); + + if (PciState.speed.gen == 5) + { + printf("Current PCI link speed is already Gen5, so nothing to do\n"); + continue; + } + + // Check if current FW supports Gen5 to Gen4 downgrade capability + ctl_firmware_properties_t BaseFwProperties = { 0 }; + BaseFwProperties.Size = sizeof(BaseFwProperties); + + res = ctlGetFirmwareProperties(hDevices[i], &BaseFwProperties); + if (res == CTL_RESULT_SUCCESS) + { + if (BaseFwProperties.FirmwareConfig & CTL_FIRMWARE_CONFIG_FLAG_IS_DEVICE_LINK_SPEED_DOWNGRADE_CAPABLE) + { + printf("FW does not support Gen5 to Gen4 downgrade capability\n"); + continue; + } + + if (BaseFwProperties.FirmwareConfig & CTL_FIRMWARE_CONFIG_FLAG_IS_DEVICE_LINK_SPEED_DOWNGRADE_ACTIVE) + { + printf("We already attempted to go to Gen5 and it probably failed, nothing else to do now"); + continue; + } + + printf("FW supports Gen5 to Gen4 downgrade capability\n"); + } + else + { + printf("Error: %d from getfirmwareproperties.", res); + } + + // Enumerate firmware components + uint32_t Count = 0; + ctl_firmware_component_handle_t *phFirmwareComponents = nullptr; + + res = ctlEnumerateFirmwareComponents(hDevices[i], &Count, nullptr); + if (res != CTL_RESULT_SUCCESS) + { + printf("Error: %d from enumeratefirmwarecomponents.", res); + continue; + } + + phFirmwareComponents = (ctl_firmware_component_handle_t *)malloc(sizeof(ctl_firmware_component_handle_t) * Count); + if (phFirmwareComponents == nullptr) + { + printf("Error: %d from malloc.", res); + continue; + } + res = ctlEnumerateFirmwareComponents(hDevices[i], &Count, phFirmwareComponents); + if (res != CTL_RESULT_SUCCESS) + { + if (phFirmwareComponents != nullptr) + free(phFirmwareComponents); + + printf("Error: %d from enumeratefirmwarecomponents.", res); + continue; + } + + for (uint32_t j = 0; j < Count; j++) + { + ctl_firmware_component_properties_t FwComponentProperties = { 0 }; + FwComponentProperties.Size = sizeof(FwComponentProperties); + + res = ctlGetFirmwareComponentProperties(phFirmwareComponents[j], &FwComponentProperties); + if (res != CTL_RESULT_SUCCESS) + { + printf("Error: %d from getfirmwarecomponentproperties.", res); + continue; + } + + printf("Fw componenent (%d) : Name: %s and Version : %s \n", j, FwComponentProperties.name, FwComponentProperties.version); + } + + if (phFirmwareComponents != nullptr) + free(phFirmwareComponents); + } + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } +Exit: + + if (hDevices != nullptr) + free(hDevices); + + ctlClose(hAPIHandle); + + printf("Overrall test result is 0x%X\n", CTL_RESULT_SUCCESS); + + return CTL_RESULT_SUCCESS; +} diff --git a/Samples/FirmwareApi/README.md b/Samples/FirmwareApi/README.md new file mode 100644 index 0000000..1942577 --- /dev/null +++ b/Samples/FirmwareApi/README.md @@ -0,0 +1 @@ +Sample Application for Firmware API interfaces diff --git a/Source/cApiWrapper.cpp b/Source/cApiWrapper.cpp index 9723b25..6e66cdb 100644 --- a/Source/cApiWrapper.cpp +++ b/Source/cApiWrapper.cpp @@ -190,8 +190,8 @@ ctlClose( } // special code - only for ctlClose() - // might get CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER - // if its open by another caller do not free the instance handle + // might get CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER + // if its open by another caller do not free the instance handle if( result == CTL_RESULT_SUCCESS) { if (NULL != hinstLib) @@ -245,12 +245,12 @@ ctlSetRuntimePath( } // special code - only for ctlSetRuntimePath() - // might get CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER - // if its open by another caller do not free the instance handle + // might get CTL_RESULT_SUCCESS_STILL_OPEN_BY_ANOTHER_CALLER + // if its open by another caller do not free the instance handle else if (pArgs->pRuntimePath) { // this is a case where the caller app is interested in loading a RT directly - // IMPORTANT NOTE: Free pArgs and pArgs->pRuntimePath only after ctlInit() call + // IMPORTANT NOTE: Free pArgs and pArgs->pRuntimePath only after ctlInit() call pRuntimeArgs = pArgs; result = CTL_RESULT_SUCCESS; } @@ -2954,6 +2954,192 @@ ctlFanGetState( } +/** +* @brief Get base firmware properties +* +* @details +* - The application gets properties of base firmware +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +*/ +ctl_result_t CTL_APICALL +ctlGetFirmwareProperties( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + ctl_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold properties of the base + ///< firmware. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetFirmwareProperties_t pfnGetFirmwareProperties = (ctl_pfnGetFirmwareProperties_t)GetProcAddress(hinstLibPtr, "ctlGetFirmwareProperties"); + if (pfnGetFirmwareProperties) + { + result = pfnGetFirmwareProperties(hDeviceAdapter, pProperties); + } + } + + return result; +} + + +/** +* @brief Get handle of various firmware components +* +* @details +* - The application enumerates all firmware components on an Intel +* Discrete Graphics device. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCount` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "KMD call failed" +*/ +ctl_result_t CTL_APICALL +ctlEnumerateFirmwareComponents( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_firmware_component_handle_t* phFirmware ///< [in,out][optional][release][range(0, *pCount)] array of handle of + ///< firmware components. + ///< If count is less than the number of firmware components that are + ///< available, then the driver shall only retrieve that number of firmware + ///< component handles. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEnumerateFirmwareComponents_t pfnEnumerateFirmwareComponents = (ctl_pfnEnumerateFirmwareComponents_t)GetProcAddress(hinstLibPtr, "ctlEnumerateFirmwareComponents"); + if (pfnEnumerateFirmwareComponents) + { + result = pfnEnumerateFirmwareComponents(hDeviceAdapter, pCount, phFirmware); + } + } + + return result; +} + + +/** +* @brief Get firmware component properties +* +* @details +* - The application gets properties of individual firmware components +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hFirmware` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "KMD call failed" +*/ +ctl_result_t CTL_APICALL +ctlGetFirmwareComponentProperties( + ctl_firmware_component_handle_t hFirmware, ///< [in] Handle for the firmware component. + ctl_firmware_component_properties_t* pProperties///< [in,out] Pointer to an array that will hold properties of the firmware + ///< component. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnGetFirmwareComponentProperties_t pfnGetFirmwareComponentProperties = (ctl_pfnGetFirmwareComponentProperties_t)GetProcAddress(hinstLibPtr, "ctlGetFirmwareComponentProperties"); + if (pfnGetFirmwareComponentProperties) + { + result = pfnGetFirmwareComponentProperties(hFirmware, pProperties); + } + } + + return result; +} + + +/** +* @brief Allows/Blocks discrete graphics device firmware's capability to train +* PCI-E link at higher speeds on compatible compatible hosts +* +* @details +* - This API allows caller to allow/block a compatible discrete graphics +* card's firmware train PCIE links at higher speeds on compatible hosts. +* - This is a reserved capability. By default, this capability will not be +* enabled, need application to activate it, please contact Intel for +* activation. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +* - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid handle" +* - ::CTL_RESULT_ERROR_KMD_CALL - "KMD call failed" +*/ +ctl_result_t CTL_APICALL +ctlAllowPCIeLinkSpeedUpdate( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + bool AllowPCIeLinkSpeedUpdate ///< [in] When set configures the device firmware to train PCI-E link at + ///< higher speeds, else this will block the device firmware from training + ///< at higher PCI-E link speeds on compatible hosts. + ///< This API modifies a flash persistant setting of the device firmware to + ///< allow/block training PCI-E link at higher speeds. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnAllowPCIeLinkSpeedUpdate_t pfnAllowPCIeLinkSpeedUpdate = (ctl_pfnAllowPCIeLinkSpeedUpdate_t)GetProcAddress(hinstLibPtr, "ctlAllowPCIeLinkSpeedUpdate"); + if (pfnAllowPCIeLinkSpeedUpdate) + { + result = pfnAllowPCIeLinkSpeedUpdate(hDeviceAdapter, AllowPCIeLinkSpeedUpdate); + } + } + + return result; +} + + /** * @brief Get handle of frequency domains * diff --git a/include/igcl_api.h b/include/igcl_api.h index 1025943..f868693 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -391,6 +391,7 @@ typedef enum _ctl_result_t CTL_RESULT_ERROR_LOAD = 0x40000026, ///< Library load failure CTL_RESULT_ERROR_UNKNOWN = 0x4000FFFF, ///< Unknown or internal error CTL_RESULT_ERROR_RETRY_OPERATION = 0x40010000, ///< Operation failed, retry previous operation again + CTL_RESULT_ERROR_IGSC_LOADER = 0x40010001, ///< IGSC library loader not found CTL_RESULT_ERROR_GENERIC_END = 0x4000FFFF, ///< "Generic error code end value, not to be used ///< " CTL_RESULT_ERROR_CORE_START = 0x44000000, ///< Core error code starting value, not to be used @@ -735,7 +736,7 @@ typedef struct _ctl_device_adapter_properties_t ctl_device_type_t device_type; ///< [out] Device Type ctl_supported_functions_flags_t supported_subfunction_flags;///< [out] Supported functions uint64_t driver_version; ///< [out] Driver version - ctl_firmware_version_t firmware_version; ///< [out] Firmware version + ctl_firmware_version_t firmware_version; ///< [out] Global Firmware version for discrete adapters. Not implemented uint32_t pci_vendor_id; ///< [out] PCI Vendor ID uint32_t pci_device_id; ///< [out] PCI Device ID uint32_t rev_id; ///< [out] PCI Revision ID @@ -744,7 +745,9 @@ typedef struct _ctl_device_adapter_properties_t uint32_t num_slices; ///< [out] Number of slices char name[CTL_MAX_DEVICE_NAME_LEN]; ///< [out] Device name ctl_adapter_properties_flags_t graphics_adapter_properties; ///< [out] Graphics Adapter Properties - uint32_t Frequency; ///< [out] Clock frequency for this device. Supported only for Version > 0 + uint32_t Frequency; ///< [out] This represents the average frequency an end user may see in the + ///< typical gaming workload. Also referred as Graphics Clock. Supported + ///< only for Version > 0 uint16_t pci_subsys_id; ///< [out] PCI SubSys ID, Supported only for Version > 1 uint16_t pci_subsys_vendor_id; ///< [out] PCI SubSys Vendor ID, Supported only for Version > 1 ctl_adapter_bdf_t adapter_bdf; ///< [out] Pci Bus, Device, Function. Supported only for Version > 1 @@ -1275,6 +1278,14 @@ typedef struct _ctl_fan_properties_t ctl_fan_properties_t; /// @brief Forward-declare ctl_fan_config_t typedef struct _ctl_fan_config_t ctl_fan_config_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_firmware_properties_t +typedef struct _ctl_firmware_properties_t ctl_firmware_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_firmware_component_properties_t +typedef struct _ctl_firmware_component_properties_t ctl_firmware_component_properties_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ctl_freq_properties_t typedef struct _ctl_freq_properties_t ctl_freq_properties_t; @@ -5091,6 +5102,196 @@ ctlFanGetState( #if !defined(__GNUC__) #pragma endregion // fan #endif +// Intel 'ctlApi' for Device Adapter - Firmware management +#if !defined(__GNUC__) +#pragma region firmware +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_FIRMWARE_PROPERTY_STR_SIZE +/// @brief Maximum number of characters in firmware name/version string +#define CTL_FIRMWARE_PROPERTY_STR_SIZE 64 +#endif // CTL_FIRMWARE_PROPERTY_STR_SIZE + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Handle for a device firmware component +typedef struct _ctl_firmware_component_handle_t *ctl_firmware_component_handle_t; + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAX_FIRMWARE_PROPERTIES_RESERVED_SIZE +/// @brief Maximum reserved size for future firmware component property members. +#define CTL_MAX_FIRMWARE_PROPERTIES_RESERVED_SIZE 16 +#endif // CTL_MAX_FIRMWARE_PROPERTIES_RESERVED_SIZE + +/////////////////////////////////////////////////////////////////////////////// +#ifndef CTL_MAX_FIRMWARE_COMPONENT_PROPERTIES_RESERVED_SIZE +/// @brief Maximum reserved size for future firmware component property members. +#define CTL_MAX_FIRMWARE_COMPONENT_PROPERTIES_RESERVED_SIZE 20 +#endif // CTL_MAX_FIRMWARE_COMPONENT_PROPERTIES_RESERVED_SIZE + +/////////////////////////////////////////////////////////////////////////////// +/// @brief [out] Firmware configuration flags +typedef uint32_t ctl_firmware_config_flags_t; +typedef enum _ctl_firmware_config_flag_t +{ + CTL_FIRMWARE_CONFIG_FLAG_IS_DEVICE_LINK_SPEED_DOWNGRADE_CAPABLE = CTL_BIT(0), ///< [out] Is the device firmware capable of downgrading to lower PCIE link + ///< speed from higher PCIE link speeds automatically on incompatible hosts. + CTL_FIRMWARE_CONFIG_FLAG_IS_DEVICE_LINK_SPEED_DOWNGRADE_ACTIVE = CTL_BIT(1),///< [out] This bit indicates if the discrete GPU host was capable of + ///< running at higher PCIE link speeds but the card firmware failed to + ///< train PCIE link at higher speeds + ///< due to non-compliant hosts. So device firmware did a fall back to + ///< lower link speeds. + CTL_FIRMWARE_CONFIG_FLAG_MAX = 0x80000000 + +} ctl_firmware_config_flag_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Base firmware properties +typedef struct _ctl_firmware_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + char name[CTL_FIRMWARE_PROPERTY_STR_SIZE]; ///< [out] NULL terminated string value for the name of the firmware + ///< component. 'unknown' will be returned if this property cannot be + ///< determined. + char version[CTL_FIRMWARE_PROPERTY_STR_SIZE]; ///< [out] NULL terminated string value for the device version of the + ///< firmware component. 'unknown' will be returned if this property cannot + ///< be determined. + ctl_firmware_config_flags_t FirmwareConfig; ///< [out] This bit indicates various firmware supported configurations and + ///< capabilities. + char reserved[CTL_MAX_FIRMWARE_PROPERTIES_RESERVED_SIZE]; ///< [out] Reserved + +} ctl_firmware_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Individual firmware component properties +typedef struct _ctl_firmware_component_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + char name[CTL_FIRMWARE_PROPERTY_STR_SIZE]; ///< [out] NULL terminated string value for the name of the firmware + ///< component. 'unknown' will be returned if this property cannot be + ///< determined. + char version[CTL_FIRMWARE_PROPERTY_STR_SIZE]; ///< [out] NULL terminated string value for the device version of the + ///< firmware component. 'unknown' will be returned if this property cannot + ///< be determined. + char reserved[CTL_MAX_FIRMWARE_COMPONENT_PROPERTIES_RESERVED_SIZE]; ///< [out] Reserved + +} ctl_firmware_component_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get base firmware properties +/// +/// @details +/// - The application gets properties of base firmware +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetFirmwareProperties( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + ctl_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold properties of the base + ///< firmware. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get handle of various firmware components +/// +/// @details +/// - The application enumerates all firmware components on an Intel +/// Discrete Graphics device. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCount` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "KMD call failed" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEnumerateFirmwareComponents( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. + ///< if count is zero, then the driver shall update the value with the + ///< total number of components of this type that are available. + ///< if count is greater than the number of components of this type that + ///< are available, then the driver shall update the value with the correct + ///< number of components. + ctl_firmware_component_handle_t* phFirmware ///< [in,out][optional][release][range(0, *pCount)] array of handle of + ///< firmware components. + ///< If count is less than the number of firmware components that are + ///< available, then the driver shall only retrieve that number of firmware + ///< component handles. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get firmware component properties +/// +/// @details +/// - The application gets properties of individual firmware components +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hFirmware` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "KMD call failed" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlGetFirmwareComponentProperties( + ctl_firmware_component_handle_t hFirmware, ///< [in] Handle for the firmware component. + ctl_firmware_component_properties_t* pProperties///< [in,out] Pointer to an array that will hold properties of the firmware + ///< component. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Allows/Blocks discrete graphics device firmware's capability to train +/// PCI-E link at higher speeds on compatible compatible hosts +/// +/// @details +/// - This API allows caller to allow/block a compatible discrete graphics +/// card's firmware train PCIE links at higher speeds on compatible hosts. +/// - This is a reserved capability. By default, this capability will not be +/// enabled, need application to activate it, please contact Intel for +/// activation. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" +/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid handle" +/// - ::CTL_RESULT_ERROR_KMD_CALL - "KMD call failed" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlAllowPCIeLinkSpeedUpdate( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] handle to control device adapter + bool AllowPCIeLinkSpeedUpdate ///< [in] When set configures the device firmware to train PCI-E link at + ///< higher speeds, else this will block the device firmware from training + ///< at higher PCI-E link speeds on compatible hosts. + ///< This API modifies a flash persistant setting of the device firmware to + ///< allow/block training PCI-E link at higher speeds. + ); + + +#if !defined(__GNUC__) +#pragma endregion // firmware +#endif // Intel 'ctlApi' for Device Adapter - Frequency domains #if !defined(__GNUC__) #pragma region frequency @@ -7768,6 +7969,39 @@ typedef ctl_result_t (CTL_APICALL *ctl_pfnFanGetState_t)( ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetFirmwareProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetFirmwareProperties_t)( + ctl_device_adapter_handle_t, + ctl_firmware_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEnumerateFirmwareComponents +typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateFirmwareComponents_t)( + ctl_device_adapter_handle_t, + uint32_t*, + ctl_firmware_component_handle_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlGetFirmwareComponentProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnGetFirmwareComponentProperties_t)( + ctl_firmware_component_handle_t, + ctl_firmware_component_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlAllowPCIeLinkSpeedUpdate +typedef ctl_result_t (CTL_APICALL *ctl_pfnAllowPCIeLinkSpeedUpdate_t)( + ctl_device_adapter_handle_t, + bool + ); + + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for ctlEnumFrequencyDomains typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumFrequencyDomains_t)( From 9f7e0cc058864a263f1bd34e02cb48e01e4f2203 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Fri, 28 Feb 2025 21:50:22 -0800 Subject: [PATCH 16/26] Updated version to v233 --- .../3D_Feature_Sample_App.cpp | 217 ++- Samples/Color_Samples/Color_Sample_App.cpp | 94 +- .../CombinedDisplay_Sample_App.cpp | 68 +- .../CustomMode_Sample_App.cpp | 36 +- .../DisplayGenlock_Sample_App.cpp | 92 +- .../DisplaySettings_Sample_App.cpp | 52 +- .../Edid_Mgmt_Sample_App.cpp | 154 +- Samples/Generic_Sample/Sample_ControlAPP.cpp | 3 +- Samples/Overclocking_Sample/README.md | 2 +- .../Sample_OverclockAPP.cpp | 1421 +++++++++-------- .../PowerFeature_Sample_App.cpp | 106 +- Samples/Scaling_Samples/Scaling_App.cpp | 53 +- .../Telemetry_Samples/Sample_TelemetryAPP.cpp | 1185 ++++---------- Samples/UBRR_Sample/UBRR_Sample_App.cpp | 16 +- Samples/inc/GenericIGCLApp.h | 123 +- Source/cApiWrapper.cpp | 623 ++++++++ include/igcl_api.h | 607 ++++++- 17 files changed, 2819 insertions(+), 2033 deletions(-) diff --git a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp index 79c2f9c..ab38cfa 100644 --- a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp +++ b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp @@ -47,7 +47,7 @@ ctl_result_t CtlEnduranceGamingTest(ctl_device_adapter_handle_t hDevices) { ctl_result_t Result = CTL_RESULT_SUCCESS; - printf("======================Endurance Gaming test -> Per Application settings======================\n"); + PRINT_LOGS("======================Endurance Gaming test -> Per Application settings======================"); char *pAppName = "GTA5.exe"; ctl_3d_feature_getset_t Get3DProperty = { 0 }; @@ -72,18 +72,18 @@ ctl_result_t CtlEnduranceGamingTest(ctl_device_adapter_handle_t hDevices) if (NULL != hDevices) { Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); - printf(" Set3DProperty.ApplicationName = %s\n", Set3DProperty.ApplicationName); - printf(" SetEnduranceGaming.EGControl = %d\n", SetEnduranceGaming.EGControl); - printf(" SetEnduranceGaming.EGMode = %d\n", SetEnduranceGaming.EGMode); + APP_LOG_INFO(" Set3DProperty.ApplicationName = %s", Set3DProperty.ApplicationName); + APP_LOG_INFO(" SetEnduranceGaming.EGControl = %d", SetEnduranceGaming.EGControl); + APP_LOG_INFO(" SetEnduranceGaming.EGMode = %d", SetEnduranceGaming.EGMode); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature(Set EnduranceGaming) returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature(Set EnduranceGaming) returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success(Set EnduranceGaming)\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success(Set EnduranceGaming)"); } } @@ -103,7 +103,7 @@ ctl_result_t CtlEnduranceGamingTest(ctl_device_adapter_handle_t hDevices) if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature(Get EnduranceGaming) returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature(Get EnduranceGaming) returned failure code: 0x%X", Result); if (nullptr != Get3DProperty.pCustomValue) { @@ -116,11 +116,11 @@ ctl_result_t CtlEnduranceGamingTest(ctl_device_adapter_handle_t hDevices) else { ctl_endurance_gaming_t *pGetEnduranceGaming = (ctl_endurance_gaming_t *)Get3DProperty.pCustomValue; - printf("ctlGetSet3DFeature returned success(Get EnduranceGaming)\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success(Get EnduranceGaming)"); - printf(" Get3DProperty.ApplicationName = %s\n", Get3DProperty.ApplicationName); - printf(" pGetEnduranceGaming->EGControl = %d\n", pGetEnduranceGaming->EGControl); - printf(" pGetEnduranceGaming->EGMode = %d\n", pGetEnduranceGaming->EGMode); + APP_LOG_INFO(" Get3DProperty.ApplicationName = %s", Get3DProperty.ApplicationName); + APP_LOG_INFO(" pGetEnduranceGaming->EGControl = %d", pGetEnduranceGaming->EGControl); + APP_LOG_INFO(" pGetEnduranceGaming->EGMode = %d", pGetEnduranceGaming->EGMode); } } @@ -130,7 +130,7 @@ ctl_result_t CtlEnduranceGamingTest(ctl_device_adapter_handle_t hDevices) Get3DProperty.pCustomValue = NULL; } - printf("======================Endurance Gaming test -> Global settings======================\n"); + PRINT_LOGS("======================Endurance Gaming test -> Global settings======================"); Get3DProperty = { 0 }; Set3DProperty = { 0 }; @@ -151,17 +151,17 @@ ctl_result_t CtlEnduranceGamingTest(ctl_device_adapter_handle_t hDevices) if (NULL != hDevices) { Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); - printf(" SetEnduranceGaming.EGControl = %d\n", SetEnduranceGaming.EGControl); - printf(" SetEnduranceGaming.EGMode = %d\n", SetEnduranceGaming.EGMode); + APP_LOG_INFO(" SetEnduranceGaming.EGControl = %d", SetEnduranceGaming.EGControl); + APP_LOG_INFO(" SetEnduranceGaming.EGMode = %d", SetEnduranceGaming.EGMode); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature(Set EnduranceGaming) returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature(Set EnduranceGaming) returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success(Set EnduranceGaming)\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success(Set EnduranceGaming)"); } } @@ -179,7 +179,7 @@ ctl_result_t CtlEnduranceGamingTest(ctl_device_adapter_handle_t hDevices) if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature(Get EnduranceGaming) returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature(Get EnduranceGaming) returned failure code: 0x%X", Result); if (nullptr != Get3DProperty.pCustomValue) { @@ -192,10 +192,10 @@ ctl_result_t CtlEnduranceGamingTest(ctl_device_adapter_handle_t hDevices) else { ctl_endurance_gaming_t *pGetEnduranceGamingGlobal = (ctl_endurance_gaming_t *)Get3DProperty.pCustomValue; - printf("ctlGetSet3DFeature returned success(Get EnduranceGaming)\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success(Get EnduranceGaming)"); - printf(" pGetEnduranceGamingGlobal->EGControl = %d\n", pGetEnduranceGamingGlobal->EGControl); - printf(" pGetEnduranceGamingGlobal->EGMode = %d\n", pGetEnduranceGamingGlobal->EGMode); + APP_LOG_INFO(" pGetEnduranceGamingGlobal->EGControl = %d", pGetEnduranceGamingGlobal->EGControl); + APP_LOG_INFO(" pGetEnduranceGamingGlobal->EGMode = %d", pGetEnduranceGamingGlobal->EGMode); } } @@ -219,7 +219,7 @@ ctl_result_t CtlGamingFlipTest(ctl_device_adapter_handle_t hDevices) // Gaming flips Per APP GET/SET ctl_result_t Result = CTL_RESULT_SUCCESS; - printf("======================Gaming flips test -> Per Application settings =====================\n"); + PRINT_LOGS("======================Gaming flips test -> Per Application settings ====================="); char *pAppName = "GTA5.exe"; ctl_3d_feature_getset_t Get3DProperty = { 0 }; ctl_3d_feature_getset_t Set3DProperty = { 0 }; @@ -241,17 +241,17 @@ ctl_result_t CtlGamingFlipTest(ctl_device_adapter_handle_t hDevices) if (NULL != hDevices) { Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); - printf(" Set3DProperty.Value.EnumType.EnableType = %d\n", Set3DProperty.Value.EnumType.EnableType); - printf(" Set3DProperty.ApplicationName = %s\n", Set3DProperty.ApplicationName); + APP_LOG_INFO(" Set3DProperty.Value.EnumType.EnableType = %d", Set3DProperty.Value.EnumType.EnableType); + APP_LOG_INFO(" Set3DProperty.ApplicationName = %s", Set3DProperty.ApplicationName); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success"); } // Get Gaming flips modes only @@ -269,22 +269,22 @@ ctl_result_t CtlGamingFlipTest(ctl_device_adapter_handle_t hDevices) Result = ctlGetSet3DFeature(hDevices, &Get3DProperty); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success\n"); - printf(" Get3DProperty.Value.EnumType.EnableType = %d\n", Get3DProperty.Value.EnumType.EnableType); - printf(" Get3DProperty.ApplicationName = %s\n", Get3DProperty.ApplicationName); + APP_LOG_INFO("ctlGetSet3DFeature returned success"); + APP_LOG_INFO(" Get3DProperty.Value.EnumType.EnableType = %d", Get3DProperty.Value.EnumType.EnableType); + APP_LOG_INFO(" Get3DProperty.ApplicationName = %s", Get3DProperty.ApplicationName); } } } // Gaming flips Global GET/SET - printf("======================Gaming flips test -> Global settings======================\n"); + PRINT_LOGS("======================Gaming flips test -> Global settings======================"); Get3DProperty = { 0 }; Set3DProperty = { 0 }; @@ -303,16 +303,16 @@ ctl_result_t CtlGamingFlipTest(ctl_device_adapter_handle_t hDevices) if (NULL != hDevices) { Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); - printf(" Set3DProperty.Value.EnumType.EnableType = %d\n", Set3DProperty.Value.EnumType.EnableType); + APP_LOG_INFO(" Set3DProperty.Value.EnumType.EnableType = %d", Set3DProperty.Value.EnumType.EnableType); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success"); } // Get Gaming flips modes only @@ -328,14 +328,14 @@ ctl_result_t CtlGamingFlipTest(ctl_device_adapter_handle_t hDevices) Result = ctlGetSet3DFeature(hDevices, &Get3DProperty); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success\n"); - printf(" Get3DProperty.Value.EnumType.EnableType = %d\n", Get3DProperty.Value.EnumType.EnableType); + APP_LOG_INFO("ctlGetSet3DFeature returned success"); + APP_LOG_INFO(" Get3DProperty.Value.EnumType.EnableType = %d", Get3DProperty.Value.EnumType.EnableType); } } } @@ -360,12 +360,12 @@ ctl_result_t CtlGet3DFeatureCaps(ctl_device_adapter_handle_t hDevices) Result = ctlGetSupported3DCapabilities(hDevices, &FeatureCaps3D); if (Result != CTL_RESULT_SUCCESS) { - printf("ctlGetSupported3DCapabilities returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSupported3DCapabilities returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSupported3DCapabilities returned success\n"); + APP_LOG_INFO("ctlGetSupported3DCapabilities returned success"); FeatureCaps3D.pFeatureDetails = (ctl_3d_feature_details_t *)malloc(sizeof(ctl_3d_feature_details_t) * FeatureCaps3D.NumSupportedFeatures); if (FeatureCaps3D.pFeatureDetails == NULL) { @@ -404,7 +404,7 @@ ctl_result_t CtlGet3DFeatureCaps(ctl_device_adapter_handle_t hDevices) } else { - printf("ctlGetSupported3DCapabilities returned failure code when called with NumSupportedFeatures set: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSupported3DCapabilities returned failure code when called with NumSupportedFeatures set: 0x%X", Result); if (nullptr != FeatureCaps3D.pFeatureDetails) { free(FeatureCaps3D.pFeatureDetails); @@ -428,13 +428,13 @@ DWORD WINAPI CtlEventThread(LPVOID ThreadParameterPtr) ctl_wait_property_change_args_t Args = { 0 }; - printf("CtlEventThread: Entering thread\n"); + APP_LOG_INFO("CtlEventThread: Entering thread"); Args.PropertyType = CTL_PROPERTY_TYPE_FLAG_MEDIA | CTL_PROPERTY_TYPE_FLAG_DISPLAY | CTL_PROPERTY_TYPE_FLAG_3D; Args.Size = sizeof(Args); Args.TimeOutMilliSec = 500; // 0.5sec - printf("CtlEventThread: Calling ctlWaitForPropertyChange() and getting to blocked state...\n"); + APP_LOG_INFO("CtlEventThread: Calling ctlWaitForPropertyChange() and getting to blocked state..."); do { @@ -443,8 +443,8 @@ DWORD WINAPI CtlEventThread(LPVOID ThreadParameterPtr) continue; } while (false == QuiteEventThread); - printf("CtlEventThread: ctlWaitForPropertyChange() unblocked return value = %d\n", Result); - printf("CtlEventThread: Exiting thread\n"); + APP_LOG_INFO("CtlEventThread: ctlWaitForPropertyChange() unblocked return value = %d", Result); + APP_LOG_INFO("CtlEventThread: Exiting thread"); return Result; } @@ -463,9 +463,8 @@ ctl_result_t CtlTestEvents(ctl_device_adapter_handle_t hAdapter) DWORD ThreadID = 0; HANDLE ThreadHandle = NULL; - printf("Do you want to listen for events (L), listen via a thread (T), quit (Q) or do series of set calls (any other key)? "); + PRINT_LOGS("Do you want to listen for events (L), listen via a thread (T), quit (Q) or do series of set calls (any other key)? "); int Key = _getch(); - printf("\n"); if ((Key == 'L') || (Key == 'l')) { Listener = true; @@ -488,13 +487,13 @@ ctl_result_t CtlTestEvents(ctl_device_adapter_handle_t hAdapter) if (NULL == ThreadHandle) { - printf("CreateThread failed!\n"); + APP_LOG_ERROR("CreateThread failed!"); Result = CTL_RESULT_ERROR_OS_CALL; break; } else { - printf("Created thread ID = 0x%X\n", ThreadID); + APP_LOG_INFO("Created thread ID = 0x%X", ThreadID); } } else @@ -505,16 +504,16 @@ ctl_result_t CtlTestEvents(ctl_device_adapter_handle_t hAdapter) Args.Size = sizeof(Args); Args.TimeOutMilliSec = 0xFFFFFFFF; // INFINITE; - printf("Calling ctlWaitForPropertyChange() and getting to blocked state...\n"); + APP_LOG_INFO("Calling ctlWaitForPropertyChange() and getting to blocked state..."); Result = ctlWaitForPropertyChange(hAdapter, &Args); // blocking call - printf("ctlWaitForPropertyChange() unblocked return value = %d\n", Result); + APP_LOG_INFO("ctlWaitForPropertyChange() unblocked return value = %d", Result); } } else { - printf("Trying a 3D set call & restoring it (overrall 2 set calls)...\n"); + APP_LOG_INFO("Trying a 3D set call & restoring it (overrall 2 set calls)..."); // try setting various parameters, or just the app once more ctl_3d_feature_getset_t Feature3D = { 0 }; @@ -549,17 +548,15 @@ ctl_result_t CtlTestEvents(ctl_device_adapter_handle_t hAdapter) if (SpawnThread) { - printf("Press any key to signal thread to exit..."); - int Key = _getch(); - printf("\n"); + PRINT_LOGS("Press any key to signal thread to exit..."); + int Key = _getch(); QuiteEventThread = true; break; // exit from loop } else { - printf("Quit(q) or continue (any other key)? "); + PRINT_LOGS("Quit(q) or continue (any other key)? "); int Key = _getch(); - printf("\n"); if ((Key == 'Q') || (Key == 'q')) { QuiteEventThread = true; @@ -602,28 +599,28 @@ ctl_result_t CtlGetGamingAppProfile(ctl_device_adapter_handle_t hDevices, ctl_3d if (NULL != hDevices) { - printf("\nDoing a GetAILProfile(%s, %s)\n", ApplicationName ? ApplicationName : "Global", AppProfileGet.TierType == CTL_3D_TIER_TYPE_FLAG_COMPATIBILITY ? "Compatibility" : "Performance"); + APP_LOG_INFO("Doing a GetAILProfile(%s, %s)", ApplicationName ? ApplicationName : "Global", AppProfileGet.TierType == CTL_3D_TIER_TYPE_FLAG_COMPATIBILITY ? "Compatibility" : "Performance"); Result = ctlGetSet3DFeature(hDevices, &Get3DProperty); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature(Get AppProfile) returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature(Get AppProfile) returned failure code: 0x%X", Result); if (Result == CTL_RESULT_ERROR_DATA_NOT_FOUND) { - printf(" Reason: Value not found\n"); - printf(" Use DefaultEnabledTierProfiles (=%s) for UI default selection if required\n", GetProfileTierName(AppProfileGet.DefaultEnabledTierProfiles, TierName, 100)); + APP_LOG_ERROR(" Reason: Value not found"); + APP_LOG_INFO(" Use DefaultEnabledTierProfiles (=%s) for UI default selection if required", GetProfileTierName(AppProfileGet.DefaultEnabledTierProfiles, TierName, 100)); } } else if (Get3DProperty.CustomValueSize > 0) { - printf("ctlGetSet3DFeature returned success(Get AppProfile)\n"); - printf(" App name = %s\n", ApplicationName == NULL ? "Global" : ApplicationName); - printf(" AppProfileGet.TierType = %s\n", GetProfileTypeName(AppProfileGet.TierType)); - printf(" AppProfileGet.EnabledTierProfiles = %s\n", GetProfileTierName(AppProfileGet.EnabledTierProfiles, TierName, 100)); - printf(" AppProfileGet.DefaultEnabledTierProfiles = %s\n", GetProfileTierName(AppProfileGet.DefaultEnabledTierProfiles, TierName, 100)); - printf(" AppProfileGet.CustomizationSupportedTierProfiles = %s\n", GetProfileTierName(AppProfileGet.CustomizationSupportedTierProfiles, TierName, 100)); - printf(" AppProfileGet.CustomizationEnabledTierProfiles = %s\n", GetProfileTierName(AppProfileGet.CustomizationEnabledTierProfiles, TierName, 100)); + APP_LOG_INFO("ctlGetSet3DFeature returned success(Get AppProfile)"); + APP_LOG_INFO(" App name = %s", ApplicationName == NULL ? "Global" : ApplicationName); + APP_LOG_INFO(" AppProfileGet.TierType = %s", GetProfileTypeName(AppProfileGet.TierType)); + APP_LOG_INFO(" AppProfileGet.EnabledTierProfiles = %s", GetProfileTierName(AppProfileGet.EnabledTierProfiles, TierName, 100)); + APP_LOG_INFO(" AppProfileGet.DefaultEnabledTierProfiles = %s", GetProfileTierName(AppProfileGet.DefaultEnabledTierProfiles, TierName, 100)); + APP_LOG_INFO(" AppProfileGet.CustomizationSupportedTierProfiles = %s", GetProfileTierName(AppProfileGet.CustomizationSupportedTierProfiles, TierName, 100)); + APP_LOG_INFO(" AppProfileGet.CustomizationEnabledTierProfiles = %s", GetProfileTierName(AppProfileGet.CustomizationEnabledTierProfiles, TierName, 100)); } } @@ -654,24 +651,24 @@ ctl_result_t CtlSetGamingAppProfile(ctl_device_adapter_handle_t hDevices, ctl_3d if (NULL != hDevices) { - printf("\nDoing a SetAILProfile(%s, %s)\n", ApplicationName ? ApplicationName : "Global", AppProfileSet.TierType == CTL_3D_TIER_TYPE_FLAG_COMPATIBILITY ? "Compatibility" : "Performance"); + APP_LOG_INFO("Doing a SetAILProfile(%s, %s)", ApplicationName ? ApplicationName : "Global", AppProfileSet.TierType == CTL_3D_TIER_TYPE_FLAG_COMPATIBILITY ? "Compatibility" : "Performance"); Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature(Set AppProfile) returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature(Set AppProfile) returned failure code: 0x%X", Result); if (CTL_RESULT_ERROR_DATA_NOT_FOUND == Result) - printf("Reason: Value not found\n"); + APP_LOG_ERROR("Reason: Value not found"); return Result; } else if (Set3DProperty.CustomValueSize > 0) { - printf("ctlGetSet3DFeature returned success(Set AppProfile)\n"); - printf(" App name = %s\n", ApplicationName == NULL ? "Global" : ApplicationName); - printf(" AppProfileSet.TierType = %s\n", GetProfileTypeName(AppProfileSet.TierType)); - printf(" AppProfileSet.EnabledTierProfiles = %s\n", GetProfileTierName(AppProfileSet.EnabledTierProfiles, TierName, 100)); - printf(" AppProfileSet.CustomizationSupportedTierProfiles = %s\n", GetProfileTierName(AppProfileSet.CustomizationSupportedTierProfiles, TierName, 100)); + APP_LOG_INFO("ctlGetSet3DFeature returned success(Set AppProfile)"); + APP_LOG_INFO(" App name = %s", ApplicationName == NULL ? "Global" : ApplicationName); + APP_LOG_INFO(" AppProfileSet.TierType = %s", GetProfileTypeName(AppProfileSet.TierType)); + APP_LOG_INFO(" AppProfileSet.EnabledTierProfiles = %s", GetProfileTierName(AppProfileSet.EnabledTierProfiles, TierName, 100)); + APP_LOG_INFO(" AppProfileSet.CustomizationSupportedTierProfiles = %s", GetProfileTierName(AppProfileSet.CustomizationSupportedTierProfiles, TierName, 100)); } } @@ -688,7 +685,7 @@ ctl_result_t CtlGamingAppProfile(ctl_device_adapter_handle_t hDevices) { ctl_result_t Result = CTL_RESULT_SUCCESS; - printf("======================Gaming App Profile test======================\n"); + PRINT_LOGS("======================Gaming App Profile test======================"); ctl_3d_app_profiles_t AppProfile = { 0 }; @@ -725,7 +722,7 @@ ctl_result_t CtlCMAAGamingFeatureTest(ctl_device_adapter_handle_t hDevices) if (NULL == hDevices) return CTL_RESULT_ERROR_INVALID_NULL_HANDLE; - printf("======================CtlCMAAGamingFeatureTest======================\n"); + PRINT_LOGS("======================CtlCMAAGamingFeatureTest======================"); ctl_3d_feature_getset_t Get3DProperty = { 0 }; ctl_3d_feature_getset_t Set3DProperty = { 0 }; @@ -740,16 +737,16 @@ ctl_result_t CtlCMAAGamingFeatureTest(ctl_device_adapter_handle_t hDevices) Get3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; Get3DProperty.Version = 0; Result = ctlGetSet3DFeature(hDevices, &Get3DProperty); - printf(" Get3DProperty.Value.EnumType.EnableType = %d\n", Get3DProperty.Value.EnumType.EnableType); + APP_LOG_INFO(" Get3DProperty.Value.EnumType.EnableType = %d", Get3DProperty.Value.EnumType.EnableType); if (CTL_RESULT_SUCCESS != Result) { - printf("Returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("Returned failure code: 0x%X", Result); if (CTL_RESULT_ERROR_DATA_NOT_FOUND != Result) // if value not present, it's expected, so continue with set/get verification return Result; } else { - printf("ctlGetSet3DFeature returned success\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success"); InitialValue = Get3DProperty.Value.EnumType.EnableType; } @@ -760,15 +757,15 @@ ctl_result_t CtlCMAAGamingFeatureTest(ctl_device_adapter_handle_t hDevices) Set3DProperty.Version = 0; Set3DProperty.Value.EnumType.EnableType = CTL_3D_CMAA_TYPES_OVERRIDE_MSAA; Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); - printf(" Set3DProperty.Value.EnumType.EnableType = CTL_3D_CMAA_TYPES_OVERRIDE_MSAA\n"); + APP_LOG_INFO(" Set3DProperty.Value.EnumType.EnableType = CTL_3D_CMAA_TYPES_OVERRIDE_MSAA"); if (CTL_RESULT_SUCCESS != Result) { - printf("Returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("Returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success"); } // Get feature back & check - global @@ -777,18 +774,18 @@ ctl_result_t CtlCMAAGamingFeatureTest(ctl_device_adapter_handle_t hDevices) Get3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; Get3DProperty.Version = 0; Result = ctlGetSet3DFeature(hDevices, &Get3DProperty); - printf(" Get3DProperty.Value.EnumType.EnableType = %d\n", Get3DProperty.Value.EnumType.EnableType); + APP_LOG_INFO(" Get3DProperty.Value.EnumType.EnableType = %d", Get3DProperty.Value.EnumType.EnableType); if (CTL_RESULT_SUCCESS != Result) { - printf("Returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("Returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success"); if (Get3DProperty.Value.EnumType.EnableType != Set3DProperty.Value.EnumType.EnableType) { - printf("ERROR: Value didn't get set!\n"); + APP_LOG_ERROR("ERROR: Value didn't get set!"); return CTL_RESULT_ERROR_UNKNOWN; } } @@ -800,15 +797,15 @@ ctl_result_t CtlCMAAGamingFeatureTest(ctl_device_adapter_handle_t hDevices) Set3DProperty.Version = 0; Set3DProperty.Value.EnumType.EnableType = InitialValue; Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); - printf(" Set3DProperty.Value.EnumType.EnableType = %d\n", Set3DProperty.Value.EnumType.EnableType); + APP_LOG_INFO(" Set3DProperty.Value.EnumType.EnableType = %d", Set3DProperty.Value.EnumType.EnableType); if (CTL_RESULT_SUCCESS != Result) { - printf("Returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("Returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success"); } return Result; @@ -825,7 +822,7 @@ ctl_result_t CtlGlobalOrPerAppTest(ctl_device_adapter_handle_t hDevices) ctl_result_t Result = CTL_RESULT_SUCCESS; char *pAppName = "GTA5.exe"; - printf("======================Global Or Per App test======================\n"); + PRINT_LOGS("======================Global Or Per App test======================"); ctl_3d_feature_getset_t Get3DProperty = { 0 }; ctl_3d_feature_getset_t Set3DProperty = { 0 }; @@ -847,18 +844,18 @@ ctl_result_t CtlGlobalOrPerAppTest(ctl_device_adapter_handle_t hDevices) if (NULL != hDevices) { Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); - printf(" Set3DProperty.ApplicationName = %s\n", Set3DProperty.ApplicationName); - printf(" Set3DProperty.Value.EnumType.EnableType = %d\n", Set3DProperty.Value.EnumType.EnableType); + APP_LOG_INFO(" Set3DProperty.ApplicationName = %s", Set3DProperty.ApplicationName); + APP_LOG_INFO(" Set3DProperty.Value.EnumType.EnableType = %d", Set3DProperty.Value.EnumType.EnableType); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature(Set Global Over Per App Setting (Set call)) returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature(Set Global Over Per App Setting (Set call)) returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success(Set Global Over Per App Setting (Set call))\n"); + APP_LOG_INFO("ctlGetSet3DFeature returned success(Set Global Over Per App Setting (Set call))"); } } @@ -878,15 +875,15 @@ ctl_result_t CtlGlobalOrPerAppTest(ctl_device_adapter_handle_t hDevices) if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSet3DFeature(Set Global Over Per App Setting (Get call)) returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlGetSet3DFeature(Set Global Over Per App Setting (Get call)) returned failure code: 0x%X", Result); return Result; } else { - printf("ctlGetSet3DFeature returned success(Set Global Over Per App Setting (Get call))\n"); - printf(" Get3DProperty.ApplicationName = %s\n", Get3DProperty.ApplicationName); - printf(" Get3DProperty.Value.EnumType.EnableTypee = %d\n", Get3DProperty.Value.EnumType.EnableType); + APP_LOG_INFO("ctlGetSet3DFeature returned success(Set Global Over Per App Setting (Get call))"); + APP_LOG_INFO(" Get3DProperty.ApplicationName = %s", Get3DProperty.ApplicationName); + APP_LOG_INFO(" Get3DProperty.Value.EnumType.EnableTypee = %d", Get3DProperty.Value.EnumType.EnableType); } } @@ -918,7 +915,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } if (CTL_RESULT_SUCCESS == Result) @@ -932,7 +929,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } if (CTL_RESULT_SUCCESS == Result) @@ -950,12 +947,12 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } } if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDevices returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlEnumerateDevices returned failure code: 0x%X", Result); goto Exit; } @@ -970,12 +967,12 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } if (CTL_RESULT_SUCCESS != Result) { - printf("CtlGet3DCaps returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("CtlGet3DCaps returned failure code: 0x%X", Result); } STORE_RESET_ERROR(Result); @@ -983,7 +980,7 @@ int main() if (CTL_RESULT_SUCCESS != Result) { - printf("CtlEnduranceGamingTest failure code: 0x%X\n", Result); + APP_LOG_ERROR("CtlEnduranceGamingTest failure code: 0x%X", Result); } STORE_RESET_ERROR(Result); @@ -991,28 +988,28 @@ int main() if (CTL_RESULT_SUCCESS != Result) { - printf("CtlGamingFlipTest failure code: 0x%X\n", Result); + APP_LOG_ERROR("CtlGamingFlipTest failure code: 0x%X", Result); } STORE_RESET_ERROR(Result); Result = CtlGamingAppProfile(hDevices[Index]); if (CTL_RESULT_SUCCESS != Result) { - printf("CtlGamingAppProfile failure code: 0x%X\n", Result); + APP_LOG_ERROR("CtlGamingAppProfile failure code: 0x%X", Result); } STORE_RESET_ERROR(Result); Result = CtlCMAAGamingFeatureTest(hDevices[Index]); if (CTL_RESULT_SUCCESS != Result) { - printf("CtlCMAAGamingFeatureTest failure code: 0x%X\n", Result); + APP_LOG_ERROR("CtlCMAAGamingFeatureTest failure code: 0x%X", Result); } STORE_RESET_ERROR(Result); Result = CtlGlobalOrPerAppTest(hDevices[Index]); if (CTL_RESULT_SUCCESS != Result) { - printf("CtlGlobalOrPerAppTest failure code: 0x%X\n", Result); + APP_LOG_ERROR("CtlGlobalOrPerAppTest failure code: 0x%X", Result); } STORE_RESET_ERROR(Result); @@ -1035,7 +1032,7 @@ int main() hDevices = nullptr; } - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } diff --git a/Samples/Color_Samples/Color_Sample_App.cpp b/Samples/Color_Samples/Color_Sample_App.cpp index 9a729e8..3c8deb5 100644 --- a/Samples/Color_Samples/Color_Sample_App.cpp +++ b/Samples/Color_Samples/Color_Sample_App.cpp @@ -783,7 +783,7 @@ ctl_result_t GetPixTxCapability(ctl_display_output_handle_t hDisplayOutput, ctl_ LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationGetConfig for query type capability"); // Number of blocks - printf("GetPixTxCapsArgs.NumBlocks = %d\n", pPixTxCaps->NumBlocks); + APP_LOG_INFO("GetPixTxCapsArgs.NumBlocks = %d", pPixTxCaps->NumBlocks); if (NULL == pPixTxCaps->pBlockConfigs) { @@ -795,26 +795,26 @@ ctl_result_t GetPixTxCapability(ctl_display_output_handle_t hDisplayOutput, ctl_ ctl_pixtx_1dlut_config_t *pOneDLutConfig = &pPixTxCaps->pBlockConfigs[i].Config.OneDLutConfig; // Block specific information - printf("pPixTxCaps->pBlockConfigs[%d].BlockId = %d\n", i, pPixTxCaps->pBlockConfigs[i].BlockId); + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].BlockId = %d", i, pPixTxCaps->pBlockConfigs[i].BlockId); if (CTL_PIXTX_BLOCK_TYPE_1D_LUT == pPixTxCaps->pBlockConfigs[i].BlockType) { - printf("Block type is CTL_PIXTX_BLOCK_TYPE_1D_LUT\n"); - printf("pPixTxCaps->pBlockConfigs[%d].Config.OneDLutConfig.NumChannels = %d\n", i, pOneDLutConfig->NumChannels); - printf("pPixTxCaps->pBlockConfigs[%d].Config.OneDLutConfig.NumSamplesPerChannel = %d\n", i, pOneDLutConfig->NumSamplesPerChannel); - printf("pPixTxCaps->pBlockConfigs[%d].Config.OneDLutConfig.SamplingType = %d\n", i, pOneDLutConfig->SamplingType); + APP_LOG_INFO("Block type is CTL_PIXTX_BLOCK_TYPE_1D_LUT"); + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].Config.OneDLutConfig.NumChannels = %d", i, pOneDLutConfig->NumChannels); + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].Config.OneDLutConfig.NumSamplesPerChannel = %d", i, pOneDLutConfig->NumSamplesPerChannel); + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].Config.OneDLutConfig.SamplingType = %d", i, pOneDLutConfig->SamplingType); } else if (CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX == pPixTxCaps->pBlockConfigs[i].BlockType) { - printf("Block type is CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX\n"); + APP_LOG_INFO("Block type is CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX"); } else if (CTL_PIXTX_BLOCK_TYPE_3D_LUT == pPixTxCaps->pBlockConfigs[i].BlockType) { - printf("Block type is CTL_PIXTX_BLOCK_TYPE_3D_LUT\n"); - printf("pPixTxCaps->pBlockConfigs[%d].Config.ThreeDLutConfig.NumSamplesPerChannel = %d\n", i, pPixTxCaps->pBlockConfigs[i].Config.ThreeDLutConfig.NumSamplesPerChannel); + APP_LOG_INFO("Block type is CTL_PIXTX_BLOCK_TYPE_3D_LUT"); + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].Config.ThreeDLutConfig.NumSamplesPerChannel = %d", i, pPixTxCaps->pBlockConfigs[i].Config.ThreeDLutConfig.NumSamplesPerChannel); } else if (CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX_AND_OFFSETS == pPixTxCaps->pBlockConfigs[i].BlockType) { - printf("Block type is CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX_AND_OFFSETS\n"); + APP_LOG_INFO("Block type is CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX_AND_OFFSETS"); } } @@ -867,7 +867,7 @@ ctl_result_t ApplyLinearCSC(ctl_display_output_handle_t hDisplayOutput, ctl_pixt if (DGLUTIndex < 0 || CscIndex < 0 || GLUTIndex < 0) { - printf("Invalid Index for DGLUT/CSC/GLUT\n"); + APP_LOG_ERROR("Invalid Index for DGLUT/CSC/GLUT"); return CTL_RESULT_ERROR_INVALID_ARGUMENT; } @@ -1052,7 +1052,7 @@ ctl_result_t RotateAndScalePanelColorSpaceToContentColorSpace(ctl_display_output if (DGLUTIndex < 0 || CscIndex < 0 || GLUTIndex < 0) { - printf("Invalid Index for DGLUT/CSC/GLUT\n"); + APP_LOG_ERROR("Invalid Index for DGLUT/CSC/GLUT"); return CTL_RESULT_ERROR_INVALID_ARGUMENT; } @@ -1247,16 +1247,16 @@ ctl_result_t GetDeGammaLut(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx Result = ctlPixelTransformationGetConfig(hDisplayOutput, &GetPixTxCurrentArgs); LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationGetConfig"); - printf("DEGamma values : LutConfig.Config.OneDLutConfig.pSampleValues\n"); + APP_LOG_INFO("DEGamma values : LutConfig.Config.OneDLutConfig.pSampleValues"); uint32_t LutDataSize = LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels; - printf("LutDataSize = %d\n ", LutDataSize); + APP_LOG_INFO("LutDataSize = %d ", LutDataSize); - printf("DeGamma values : LutConfig.Config.OneDLutConfig.pSampleValues\n"); + APP_LOG_INFO("DeGamma values : LutConfig.Config.OneDLutConfig.pSampleValues"); for (uint32_t i = 0; i < LutDataSize; i++) { - printf("[%d] = %f\n", i, LutConfig.Config.OneDLutConfig.pSampleValues[i]); + APP_LOG_INFO("[%d] = %f", i, LutConfig.Config.OneDLutConfig.pSampleValues[i]); } Exit: @@ -1359,13 +1359,13 @@ ctl_result_t GetGammaLut(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_p LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationGetConfig"); uint32_t LutDataSize = LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels; - printf("LutDataSize = %d\n ", LutDataSize); + APP_LOG_INFO("LutDataSize = %d ", LutDataSize); - printf("Gamma values : LutConfig.Config.OneDLutConfig.pSampleValues\n"); + APP_LOG_INFO("Gamma values : LutConfig.Config.OneDLutConfig.pSampleValues"); for (uint32_t i = 0; i < LutDataSize; i++) { - printf("[%d] = %f\n", i, LutConfig.Config.OneDLutConfig.pSampleValues[i]); + APP_LOG_INFO("[%d] = %f", i, LutConfig.Config.OneDLutConfig.pSampleValues[i]); } Exit: @@ -1603,7 +1603,7 @@ void GetSetDeGamma(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_ge if (DGLUTIndex < 0) { - printf("Invalid DGLut Index\n"); + APP_LOG_ERROR("Invalid DGLut Index"); goto Exit; } @@ -1611,7 +1611,7 @@ void GetSetDeGamma(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_ge Result = SetDeGammaLut(hDisplayOutput, pPixTxCaps, DGLUTIndex); if (CTL_RESULT_SUCCESS != Result) { - printf("SetDeGammaLut call failed\n"); + APP_LOG_ERROR("SetDeGammaLut call failed"); STORE_AND_RESET_ERROR(Result); } else @@ -1620,7 +1620,7 @@ void GetSetDeGamma(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_ge Result = GetDeGammaLut(hDisplayOutput, pPixTxCaps, DGLUTIndex); if (CTL_RESULT_SUCCESS != Result) { - printf("GetDeGamma call failed\n"); + APP_LOG_ERROR("GetDeGamma call failed"); LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "GetDeGammaLut"); } } @@ -1656,7 +1656,7 @@ void GetSetGamma(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_ if (OneDLUTIndex < 0) { - printf("Invalid OneDLut Index\n"); + APP_LOG_ERROR("Invalid OneDLut Index"); goto Exit; } @@ -1665,7 +1665,7 @@ void GetSetGamma(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_ if (CTL_RESULT_SUCCESS != Result) { - printf("SetGammaLut call failed\n"); + APP_LOG_ERROR("SetGammaLut call failed"); STORE_AND_RESET_ERROR(Result); } else @@ -1703,7 +1703,7 @@ void GetSet3DLUT(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_ if (ThreeDLutBlockIndex < 0) { - printf("Invalid ThreeDLut Index\n"); + APP_LOG_ERROR("Invalid ThreeDLut Index"); goto Exit; } @@ -1711,7 +1711,7 @@ void GetSet3DLUT(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_ if (CTL_RESULT_SUCCESS != Result) { - printf("Set3DLut call failed\n"); + APP_LOG_ERROR("Set3DLut call failed"); STORE_AND_RESET_ERROR(Result); } else @@ -1750,7 +1750,7 @@ ctl_result_t TestBrightnessContrastGamma(ctl_display_output_handle_t hDisplayOut if (DesktopGammaBlockIndex < 0) { - printf("ctlPixelTransformationGetConfig did not report 1DLUT capability\n"); + APP_LOG_ERROR("ctlPixelTransformationGetConfig did not report 1DLUT capability"); STORE_AND_RESET_ERROR(Result); } else @@ -1806,7 +1806,7 @@ ctl_result_t TestPartialSaturation(ctl_display_output_handle_t hDisplayOutput, c if (PartialSatBlockIndex < 0) { - printf("ctlPixelTransformationGetConfig did not report 3DLUT capability for partial saturation\n"); + APP_LOG_ERROR("ctlPixelTransformationGetConfig did not report 3DLUT capability for partial saturation"); STORE_AND_RESET_ERROR(Result); } @@ -1854,10 +1854,10 @@ ctl_result_t TestPixTxGetSetConfig(ctl_display_output_handle_t hDisplayOutput) } // Logical Pipeline details in current mode - printf("Logical Pipeline Input Color Model : %d , Color Space %d, Encoding Type: %d \n", PixTxCaps.InputPixelFormat.ColorModel, PixTxCaps.InputPixelFormat.ColorSpace, - PixTxCaps.InputPixelFormat.EncodingType); - printf("Logical Pipeline Output Color Model : %d , Color Space %d, Encoding Type: %d , BPC: %d \n", PixTxCaps.InputPixelFormat.ColorModel, PixTxCaps.InputPixelFormat.ColorSpace, - PixTxCaps.InputPixelFormat.EncodingType, PixTxCaps.OutputPixelFormat.BitsPerColor); + APP_LOG_INFO("Logical Pipeline Input Color Model : %d , Color Space %d, Encoding Type: %d ", PixTxCaps.InputPixelFormat.ColorModel, PixTxCaps.InputPixelFormat.ColorSpace, + PixTxCaps.InputPixelFormat.EncodingType); + APP_LOG_INFO("Logical Pipeline Output Color Model : %d , Color Space %d, Encoding Type: %d , BPC: %d ", PixTxCaps.InputPixelFormat.ColorModel, PixTxCaps.InputPixelFormat.ColorSpace, + PixTxCaps.InputPixelFormat.EncodingType, PixTxCaps.OutputPixelFormat.BitsPerColor); const uint8_t NumBlocksToQuery = PixTxCaps.NumBlocks; // Query about the blocks in the pipeline @@ -1898,7 +1898,7 @@ ctl_result_t TestPixTxGetSetConfig(ctl_display_output_handle_t hDisplayOutput) if (CscBlockIndex < 0) { - printf("ctlPixelTransformationGetConfig did not report CSC capability\n"); + APP_LOG_ERROR("ctlPixelTransformationGetConfig did not report CSC capability"); STORE_AND_RESET_ERROR(Result); } else @@ -1957,7 +1957,7 @@ ctl_result_t TestLaceGetSetConfigForFixedAgressiveness(ctl_display_output_handle if (CTL_POWER_OPTIMIZATION_FLAG_LACE != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_LACE)) { - printf("LACE is not supported\n"); + APP_LOG_WARN("LACE is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } @@ -2008,7 +2008,7 @@ ctl_result_t TestLaceGetSetConfigForALS(ctl_display_output_handle_t hDisplayOutp if (CTL_POWER_OPTIMIZATION_FLAG_LACE != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_LACE)) { - printf("LACE is not supported\n"); + APP_LOG_WARN("LACE is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } @@ -2076,13 +2076,13 @@ ctl_result_t TestToOverrideColorModelAndColorDepth(ctl_display_output_handle_t h Result = ctlGetSetWireFormat(hDisplayOutput, &CurrentWireFormatSetting); LOG_AND_EXIT_ON_ERROR(Result, "GET Call using ctlGetSetWireFormat"); - printf("Current ColorModel %d", CurrentWireFormatSetting.WireFormat.ColorModel); - printf("Current ColorDepth %d", CurrentWireFormatSetting.WireFormat.ColorDepth); + APP_LOG_INFO("Current ColorModel %d", CurrentWireFormatSetting.WireFormat.ColorModel); + APP_LOG_INFO("Current ColorDepth %d", CurrentWireFormatSetting.WireFormat.ColorDepth); for (uint32_t Index = 0; Index < CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED; Index++) { - printf("Supported ColorModel %d", CurrentWireFormatSetting.SupportedWireFormat[Index].ColorModel); - printf("Supported ColorDepth %d", CurrentWireFormatSetting.SupportedWireFormat[Index].ColorDepth); + APP_LOG_INFO("Supported ColorModel %d", CurrentWireFormatSetting.SupportedWireFormat[Index].ColorModel); + APP_LOG_INFO("Supported ColorDepth %d", CurrentWireFormatSetting.SupportedWireFormat[Index].ColorDepth); } // SET call @@ -2128,7 +2128,7 @@ ctl_result_t TestColorForEnumDisplayHandles(ctl_display_output_handle_t *hDispla if (FALSE == IsDisplayActive || FALSE == IsDisplayAttached) { - printf("Display %d is not attached/Active, skipping the call for this display\n", DisplayIndex); + APP_LOG_WARN("Display %d is not attached/Active, skipping the call for this display", DisplayIndex); continue; } @@ -2171,13 +2171,13 @@ ctl_result_t TestDisplays(uint32_t AdapterCount, ctl_device_adapter_handle_t *hD if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } else if (DisplayCount <= 0) { - printf("Invalid Display Count. skipping display enumration for adapter:%d\n", AdapterIndex); + APP_LOG_WARN("Invalid Display Count. skipping display enumration for adapter:%d", AdapterIndex); continue; } @@ -2193,7 +2193,7 @@ ctl_result_t TestDisplays(uint32_t AdapterCount, ctl_device_adapter_handle_t *hD if (CTL_RESULT_SUCCESS != Result) { - printf("TestColorForEnumDisplayHandles returned failure code: 0x%X\n", Result); + APP_LOG_WARN("TestColorForEnumDisplayHandles returned failure code: 0x%X", Result); } CTL_FREE_MEM(hDisplayOutput); @@ -2235,7 +2235,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -2247,7 +2247,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -2260,7 +2260,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } Result = TestDisplays(AdapterCount, hDevices); @@ -2270,6 +2270,6 @@ int main() ctlClose(hAPIHandle); CTL_FREE_MEM(hDevices); - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } diff --git a/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp b/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp index b7846fb..5b5ae61 100644 --- a/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp +++ b/Samples/CombinedDisplay/CombinedDisplay_Sample_App.cpp @@ -56,14 +56,14 @@ enum ChildInfoIndex ***************************************************************/ void PrintUsage(char *pArgv[]) { - printf("Combined Display Sample Test Application.\n"); - printf("\nUsage: %s [Combined Display Port] \n", pArgv[0]); - printf("\nCombined Display Port - 0 | 1\n"); - printf("\tCombined Display port number you want to disable or query. Default is 0.\n"); - printf("Config File - sample config file\n"); - printf("\tEnable.cfg - Enabling 1x2 mode of Combined Display with 1080p displays\n"); - printf("\tDisable.cfg - Disabling Combined Display\n"); - printf("\tQuery.cfg - Querying current Combined Display topology\n"); + APP_LOG_INFO("Combined Display Sample Test Application."); + APP_LOG_INFO("Usage: %s [Combined Display Port] ", pArgv[0]); + APP_LOG_INFO("Combined Display Port - 0 | 1"); + APP_LOG_INFO("Combined Display port number you want to disable or query. Default is 0."); + APP_LOG_INFO("Config File - sample config file"); + APP_LOG_INFO("Enable.cfg - Enabling 1x2 mode of Combined Display with 1080p displays"); + APP_LOG_INFO("Disable.cfg - Disabling Combined Display"); + APP_LOG_INFO("Query.cfg - Querying current Combined Display topology"); } /*************************************************************** @@ -82,7 +82,7 @@ ctl_result_t ParseArguments(const char *pCDArgFile, ctl_combined_display_args_t if (false == ConfigFile.is_open()) { - printf("Cannot open a config file.\n"); + APP_LOG_ERROR("Cannot open a config file."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } @@ -107,7 +107,7 @@ ctl_result_t ParseArguments(const char *pCDArgFile, ctl_combined_display_args_t } // Print lines - printf("%s = %s\n", Name.c_str(), Value.c_str()); + APP_LOG_INFO("%s = %s", Name.c_str(), Value.c_str()); // Fill out combined display config arguments pCombinedDisplayArgs->Size = sizeof(ctl_combined_display_args_t); @@ -163,7 +163,7 @@ ctl_result_t ParseChildInfoArguments(const char *pCDArgFile, ctl_combined_displa if (false == ConfigFile.is_open()) { - printf("Cannot open a config file.\n"); + APP_LOG_ERROR("Cannot open a config file."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } @@ -296,7 +296,7 @@ ctl_result_t ParseDisplayOrderArguments(uint8_t NumOutputs, const char *pCDArgFi if (false == ConfigFile.is_open()) { - printf("Cannot open a config file.\n"); + APP_LOG_ERROR("Cannot open a config file."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } @@ -362,23 +362,23 @@ void PrintCombinedConfig(const ctl_combined_display_args_t CombinedDisplayArgs) ctl_rect_t FbSrc, FbPos; ctl_child_display_target_mode_t TargetMode; - printf("========= Combined Display Configuration =========\n"); - printf("Number of Display Outputs: %u\n", CombinedDisplayArgs.NumOutputs); - printf("Combined Display Width: %u\n", CombinedDisplayArgs.CombinedDesktopWidth); - printf("Combined Display Height: %u\n", CombinedDisplayArgs.CombinedDesktopHeight); + PRINT_LOGS("========= Combined Display Configuration ========="); + APP_LOG_INFO("Number of Display Outputs: %u", CombinedDisplayArgs.NumOutputs); + APP_LOG_INFO("Combined Display Width: %u", CombinedDisplayArgs.CombinedDesktopWidth); + APP_LOG_INFO("Combined Display Height: %u", CombinedDisplayArgs.CombinedDesktopHeight); for (uint8_t i = 0; i < CombinedDisplayArgs.NumOutputs; i++) { FbSrc = CombinedDisplayArgs.pChildInfo[i].FbSrc; FbPos = CombinedDisplayArgs.pChildInfo[i].FbPos; TargetMode = CombinedDisplayArgs.pChildInfo[i].TargetMode; - printf("Display[%u]: ", i); - printf("{%u,%u,%u,%u},", FbSrc.Left, FbSrc.Top, FbSrc.Right, FbSrc.Bottom); - printf("{%u,%u,%u,%u},", FbPos.Left, FbPos.Top, FbPos.Right, FbPos.Bottom); - printf("%u,", CombinedDisplayArgs.pChildInfo[i].DisplayOrientation); - printf("{%u,%u,%.1f}\n", TargetMode.Width, TargetMode.Height, TargetMode.RefreshRate); + APP_LOG_INFO("Display[%u]: ", i); + APP_LOG_INFO("{%u,%u,%u,%u},", FbSrc.Left, FbSrc.Top, FbSrc.Right, FbSrc.Bottom); + APP_LOG_INFO("{%u,%u,%u,%u},", FbPos.Left, FbPos.Top, FbPos.Right, FbPos.Bottom); + APP_LOG_INFO("%u,", CombinedDisplayArgs.pChildInfo[i].DisplayOrientation); + APP_LOG_INFO("{%u,%u,%.1f}", TargetMode.Width, TargetMode.Height, TargetMode.RefreshRate); } - printf("==========================================================\n"); + PRINT_LOGS("=========================================================="); } /*************************************************************** @@ -491,7 +491,7 @@ ctl_result_t TestCombinedDisplay(uint32_t AdapterCount, ctl_device_adapter_handl } else if (DisplayCount <= 0) { - printf("Invalid Display Count. Skipping display enumeration for adapter: %d\n", Index); + APP_LOG_WARN("Invalid Display Count. Skipping display enumeration for adapter: %d", Index); CTL_FREE_MEM(pSelectedDisplays); continue; } @@ -519,7 +519,7 @@ ctl_result_t TestCombinedDisplay(uint32_t AdapterCount, ctl_device_adapter_handl if (NULL == pHDisplayOutput[i]) { - printf("pHDisplayOutput[%d] is NULL.\n", i); + APP_LOG_ERROR("pHDisplayOutput[%d] is NULL.", i); Result = CTL_RESULT_ERROR_INVALID_NULL_HANDLE; EXIT_ON_ERROR(Result); } @@ -559,7 +559,7 @@ ctl_result_t TestCombinedDisplay(uint32_t AdapterCount, ctl_device_adapter_handl { if (CombinedDisplayArgs.NumOutputs > NumActiveOutputs) { - printf("The input NumOutputs of %u is greater than the system's NumActiveOutputs of %u.\n", CombinedDisplayArgs.NumOutputs, NumActiveOutputs); + APP_LOG_ERROR("The input NumOutputs of %u is greater than the system's NumActiveOutputs of %u.", CombinedDisplayArgs.NumOutputs, NumActiveOutputs); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } @@ -569,7 +569,7 @@ ctl_result_t TestCombinedDisplay(uint32_t AdapterCount, ctl_device_adapter_handl { if ((CTL_DISPLAY_ORIENTATION_0 != CombinedDisplayArgs.pChildInfo[i].DisplayOrientation) && (CTL_DISPLAY_ORIENTATION_180 != CombinedDisplayArgs.pChildInfo[i].DisplayOrientation)) { - printf("Only 0/180 degree rotation is supported.\n"); + APP_LOG_ERROR("Only 0/180 degree rotation is supported."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } @@ -584,7 +584,7 @@ ctl_result_t TestCombinedDisplay(uint32_t AdapterCount, ctl_device_adapter_handl Result = ctlGetSetCombinedDisplay(hDevices[Index], &CombinedDisplayArgs); if (CTL_RESULT_SUCCESS == Result && CombinedDisplayArgs.IsSupported == false) { - printf("The following Combined Display configuration is not supported\n"); + APP_LOG_WARN("The following Combined Display configuration is not supported"); PrintCombinedConfig(CombinedDisplayArgs); } } @@ -688,7 +688,7 @@ int main(int argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -700,7 +700,7 @@ int main(int argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -713,7 +713,7 @@ int main(int argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } try @@ -723,15 +723,15 @@ int main(int argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } catch (const std::ios_base::failure &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } catch (const std::bad_cast &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } Exit: @@ -739,6 +739,6 @@ int main(int argc, char *pArgv[]) ctlClose(hAPIHandle); CTL_FREE_MEM(hDevices); - printf("Overall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overall test result is 0x%X", GResult); return GResult; } \ No newline at end of file diff --git a/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp b/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp index c7a7217..187f79c 100644 --- a/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp +++ b/Samples/Custom_Mode_Samples/CustomMode_Sample_App.cpp @@ -66,12 +66,12 @@ ctl_result_t GetCustomModes(ctl_display_output_handle_t hDisplayOutput) if (0 == NumOfCustomModes) { - printf("\n No Custom modes added.\n"); + APP_LOG_WARN("No Custom modes added."); goto Exit; } else { - printf("\n Number of custom modes:%d", NumOfCustomModes); + APP_LOG_INFO("Number of custom modes:%d", NumOfCustomModes); } pCustomModeSourceSize = NumOfCustomModes * sizeof(ctl_custom_src_mode_t); @@ -94,15 +94,13 @@ ctl_result_t GetCustomModes(ctl_display_output_handle_t hDisplayOutput) pCustomSourceModesList = pCustomSourceModes; - printf("\n No.\tSourceX\tSourceY\n"); + APP_LOG_INFO("No.\tSourceX\tSourceY"); for (uint8_t i = 0; i < NumOfCustomModes; i++) { - printf(" %d\t%d\t%d\n", i, pCustomSourceModesList->SourceX, pCustomSourceModesList->SourceY); + APP_LOG_INFO(" %d\t%d\t%d", i, pCustomSourceModesList->SourceX, pCustomSourceModesList->SourceY); pCustomSourceModesList++; } - printf("\n"); - Exit: CTL_FREE_MEM(pCustomSourceModes); return Result; @@ -135,7 +133,7 @@ ctl_result_t AddCustomModes(ctl_display_output_handle_t hDisplayOutput, uint32_t pCustomSourceMode->SourceX = SourceX; pCustomSourceMode->SourceY = SourceY; - printf("\nAdding Custom mode X:%d Y:%d\n", SourceX, SourceY); + APP_LOG_INFO("Adding Custom mode X:%d Y:%d", SourceX, SourceY); // Add Custom mode. Result = ctlGetSetCustomMode(hDisplayOutput, &AddCustomMode); @@ -187,7 +185,7 @@ ctl_result_t RemoveCustomModes(ctl_display_output_handle_t hDisplayOutput) pCustomSourceModesList->SourceX = Modes[i].X; pCustomSourceModesList->SourceY = Modes[i].Y; pCustomSourceModesList++; - printf("Removing Custom mode X:%d Y:%d\n", Modes[i].X, Modes[i].Y); + APP_LOG_INFO("Removing Custom mode X:%d Y:%d", Modes[i].X, Modes[i].Y); } // Add Custom mode. @@ -225,12 +223,12 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput if (FALSE == IsDisplayAttached) { - printf("Display %d is not attached, skipping the call for this display\n", DisplayIndex); + APP_LOG_WARN("Display %d is not attached, skipping the call for this display", DisplayIndex); continue; } else { - printf("Attached Display Count: %d\n", DisplayIndex); + APP_LOG_INFO("Attached Display Count: %d", DisplayIndex); } // At a time only one custom mode add operation is supported @@ -287,13 +285,13 @@ ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } else if (DisplayCount <= 0) { - printf("Invalid Display Count. skipping display enumration for adapter:%d\n", AdapterIndex); + APP_LOG_WARN("Invalid Display Count. skipping display enumration for adapter:%d", AdapterIndex); continue; } @@ -305,7 +303,7 @@ ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -315,7 +313,7 @@ ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateDisplayHandles returned failure code: 0x%X\n", Result); + APP_LOG_WARN("EnumerateDisplayHandles returned failure code: 0x%X", Result); } CTL_FREE_MEM(hDisplayOutput); @@ -358,7 +356,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -370,7 +368,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -383,14 +381,14 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } Result = EnumerateTargetDisplays(hDisplayOutput, AdapterCount, hDevices); if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateTargetDisplays returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateTargetDisplays returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -399,6 +397,6 @@ int main() ctlClose(hAPIHandle); CTL_FREE_MEM(hDisplayOutput); CTL_FREE_MEM(hDevices); - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } diff --git a/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp b/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp index cd497be..56f602d 100644 --- a/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp +++ b/Samples/DisplayGenlock/DisplayGenlock_Sample_App.cpp @@ -53,25 +53,25 @@ ctl_result_t GResult = CTL_RESULT_SUCCESS; ***************************************************************/ void PrintTopology(ctl_genlock_args_t *pGenlockArgs, uint32_t AdapterCount) { - printf("========= Genlock Topology =========\n"); + PRINT_LOGS("========= Genlock Topology ========="); for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) { - printf("Adapter %u:\n", AdapterIndex); - printf("\tIsGenlockEnabled : %s\n", pGenlockArgs[AdapterIndex].IsGenlockEnabled ? "true" : "false"); - printf("\tIsGenlockPossible : %s\n", pGenlockArgs[AdapterIndex].IsGenlockPossible ? "true" : "false"); + APP_LOG_INFO("Adapter %u:", AdapterIndex); + APP_LOG_INFO("\tIsGenlockEnabled : %s", pGenlockArgs[AdapterIndex].IsGenlockEnabled ? "true" : "false"); + APP_LOG_INFO("\tIsGenlockPossible : %s", pGenlockArgs[AdapterIndex].IsGenlockPossible ? "true" : "false"); if (true == pGenlockArgs[AdapterIndex].IsGenlockEnabled) { - printf("\tIsPrimaryGenlockSystem : %s\n", pGenlockArgs[AdapterIndex].GenlockTopology.IsPrimaryGenlockSystem ? "true" : "false"); - printf("\tNumber of Genlock displays : %d\n", pGenlockArgs[AdapterIndex].GenlockTopology.NumGenlockDisplays); + APP_LOG_INFO("\tIsPrimaryGenlockSystem : %s", pGenlockArgs[AdapterIndex].GenlockTopology.IsPrimaryGenlockSystem ? "true" : "false"); + APP_LOG_INFO("\tNumber of Genlock displays : %d", pGenlockArgs[AdapterIndex].GenlockTopology.NumGenlockDisplays); for (int8_t DisplayIndex = 0; DisplayIndex < pGenlockArgs[AdapterIndex].GenlockTopology.NumGenlockDisplays; DisplayIndex++) { - printf("\tDisplay %u:\n", DisplayIndex); - printf("\t\tDisplay output handle : %p\n", pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo[DisplayIndex].hDisplayOutput); - printf("\t\tPrimary pipe : %s\n", pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo[DisplayIndex].IsPrimary ? "true" : "false"); + APP_LOG_INFO("\tDisplay %u:", DisplayIndex); + APP_LOG_INFO("\t\tDisplay output handle : %p", pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo[DisplayIndex].hDisplayOutput); + APP_LOG_INFO("\t\tPrimary pipe : %s", pGenlockArgs[AdapterIndex].GenlockTopology.pGenlockDisplayInfo[DisplayIndex].IsPrimary ? "true" : "false"); } } } - printf("====================================\n"); + PRINT_LOGS("===================================="); } /*************************************************************** @@ -82,24 +82,24 @@ void PrintTopology(ctl_genlock_args_t *pGenlockArgs, uint32_t AdapterCount) ***************************************************************/ void PrintUsage(char *pArgv[]) { - printf("Genlock Sample Test Application.\n"); - printf("\nUsage: %s [Operation] <-g Genlock_Mode> <-d Display_Type> <-n Number_Of_Primary_Adapters>\n", pArgv[0]); - printf("Operation\n"); - printf("\t-timing : Get target mode timing details supported by each display\n"); - printf("\t-validate : Validate Genlock configuration\n"); - printf("\t-enable : Enable Genlock\n"); - printf("\t-topology : Get current Genlock topology\n"); - printf("\t-disable : Disable Genlock\n"); - printf("\t-vblankts : Get VBlank Timestamp\n"); - printf("\t-help : Display usage\n"); - printf("-g [Genlock mode]\n"); - printf("\tprimary : primary system providing ref clock and ref sync (default)\n"); - printf("\tsecondary : secondary system referring ref clock and ref sync from primary\n"); - printf("-d [Display type]\n"); - printf("\tdp : Display Port (default)\n"); - printf("\thdmi : HDMI\n"); - printf("-p [PCIe BUS ID of Primary Adapter]\n"); - printf("\tDesignate PCIe BUS ID of adapter you want to set as a primary (default : 0)\n"); + APP_LOG_INFO("Genlock Sample Test Application."); + APP_LOG_INFO("Usage: %s [Operation] <-g Genlock_Mode> <-d Display_Type> <-n Number_Of_Primary_Adapters>", pArgv[0]); + APP_LOG_INFO("Operation"); + APP_LOG_INFO("\t-timing : Get target mode timing details supported by each display"); + APP_LOG_INFO("\t-validate : Validate Genlock configuration"); + APP_LOG_INFO("\t-enable : Enable Genlock"); + APP_LOG_INFO("\t-topology : Get current Genlock topology"); + APP_LOG_INFO("\t-disable : Disable Genlock"); + APP_LOG_INFO("\t-vblankts : Get VBlank Timestamp"); + APP_LOG_INFO("\t-help : Display usage"); + APP_LOG_INFO("-g [Genlock mode]"); + APP_LOG_INFO("\tprimary : primary system providing ref clock and ref sync (default)"); + APP_LOG_INFO("\tsecondary : secondary system referring ref clock and ref sync from primary"); + APP_LOG_INFO("-d [Display type]"); + APP_LOG_INFO("\tdp : Display Port (default)"); + APP_LOG_INFO("\thdmi : HDMI"); + APP_LOG_INFO("-p [PCIe BUS ID of Primary Adapter]"); + APP_LOG_INFO("\tDesignate PCIe BUS ID of adapter you want to set as a primary (default : 0)"); } /*************************************************************** @@ -185,7 +185,7 @@ ctl_result_t GetCmdlineArgs(int Argc, char *pArgv[], genlock_sample_args *pGenlo pGenlockSampleArgs->IsGenlockPrimary = false; } } - printf("[in] Genlock Mode: %s\n", pGenlockSampleArgs->IsGenlockPrimary == true ? "primary" : "secondary"); + APP_LOG_INFO("[in] Genlock Mode: %s", pGenlockSampleArgs->IsGenlockPrimary == true ? "primary" : "secondary"); // Display Type option if (CTL_RESULT_SUCCESS == FindOptionArg(Argc, pArgv, "-d", OptionArg)) { @@ -194,7 +194,7 @@ ctl_result_t GetCmdlineArgs(int Argc, char *pArgv[], genlock_sample_args *pGenlo pGenlockSampleArgs->PortType = CTL_DISPLAY_OUTPUT_TYPES_HDMI; } } - printf("[in] Display Type: %s\n", pGenlockSampleArgs->PortType == CTL_DISPLAY_OUTPUT_TYPES_HDMI ? "hdmi" : "dp"); + APP_LOG_INFO("[in] Display Type: %s", pGenlockSampleArgs->PortType == CTL_DISPLAY_OUTPUT_TYPES_HDMI ? "hdmi" : "dp"); // Primary BUS ID option if (CTL_RESULT_SUCCESS == FindOptionArg(Argc, pArgv, "-p", OptionArg)) { @@ -204,7 +204,7 @@ ctl_result_t GetCmdlineArgs(int Argc, char *pArgv[], genlock_sample_args *pGenlo { if (!isdigit(OptionArg[Index])) { - printf("Invalid PCIe BUS ID.\n"); + APP_LOG_ERROR("Invalid PCIe BUS ID."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } @@ -212,7 +212,7 @@ ctl_result_t GetCmdlineArgs(int Argc, char *pArgv[], genlock_sample_args *pGenlo pGenlockSampleArgs->PrimaryBusId = stoul(OptionArg, 0, 10); } } - printf("[in] BUS ID of primary adapter: %u\n", pGenlockSampleArgs->PrimaryBusId); + APP_LOG_INFO("[in] BUS ID of primary adapter: %u", pGenlockSampleArgs->PrimaryBusId); Exit: return Result; @@ -253,7 +253,7 @@ ctl_result_t GetVblankTimestamp(ctl_device_adapter_handle_t *hDevices, uint32_t } else if (DisplayCount <= 0) { - printf("Invalid Display Count. Skipping display enumeration for adapter: %d\n", AdapterIndex); + APP_LOG_WARN("Invalid Display Count. Skipping display enumeration for adapter: %d", AdapterIndex); continue; } @@ -263,7 +263,7 @@ ctl_result_t GetVblankTimestamp(ctl_device_adapter_handle_t *hDevices, uint32_t Result = ctlEnumerateDisplayOutputs(hDevices[AdapterIndex], &DisplayCount, hDisplayOutput); LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); - printf("Adapter %u:\n", AdapterIndex); + APP_LOG_INFO("Adapter %u:", AdapterIndex); for (uint8_t DisplayIndex = 0; DisplayIndex < DisplayCount; DisplayIndex++) { ctl_display_properties_t stDisplayProperties = {}; @@ -271,7 +271,7 @@ ctl_result_t GetVblankTimestamp(ctl_device_adapter_handle_t *hDevices, uint32_t if (NULL == hDisplayOutput[DisplayIndex]) { - printf("\thDisplayOutput[%d] is NULL.\n", DisplayIndex); + APP_LOG_ERROR("\thDisplayOutput[%d] is NULL.", DisplayIndex); Result = CTL_RESULT_ERROR_INVALID_NULL_HANDLE; EXIT_ON_ERROR(Result); } @@ -300,7 +300,7 @@ ctl_result_t GetVblankTimestamp(ctl_device_adapter_handle_t *hDevices, uint32_t for (uint8_t i = 0; i < VblankTsArgs.NumOfTargets; i++) { - printf("\tTarget ID: %d Child[%d] vblank timestamp: %I64d\n", stDisplayProperties.Os_display_encoder_handle.WindowsDisplayEncoderID, i, VblankTsArgs.VblankTS[i]); + APP_LOG_INFO("\tTarget ID: %d Child[%d] vblank timestamp: %I64d", stDisplayProperties.Os_display_encoder_handle.WindowsDisplayEncoderID, i, VblankTsArgs.VblankTS[i]); } } @@ -485,10 +485,10 @@ ctl_result_t TestGenlockValidate(ctl_device_adapter_handle_t *hDevices, ctl_genl Result = ctlGetSetDisplayGenlock(hDevices, pGenlockArgs, AdapterCount, &hFailureDeviceAdapter); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplayGenlock"); - printf("========= Genlock Validate =========\n"); + PRINT_LOGS("========= Genlock Validate ========="); for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) { - printf("Adapter[%u]: IsGenlockPossible : %s\n", AdapterIndex, pGenlockArgs[AdapterIndex].IsGenlockPossible ? "true" : "false"); + APP_LOG_INFO("Adapter[%u]: IsGenlockPossible : %s", AdapterIndex, pGenlockArgs[AdapterIndex].IsGenlockPossible ? "true" : "false"); } Exit: @@ -626,7 +626,7 @@ ctl_result_t InitGenlockArgs(ctl_device_adapter_handle_t *hDevices, uint32_t Ada } else if (DisplayCount <= 0) { - printf("Invalid display count for adapter: %d\n", AdapterIndex); + APP_LOG_ERROR("Invalid display count for adapter: %d", AdapterIndex); LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); } @@ -647,7 +647,7 @@ ctl_result_t InitGenlockArgs(ctl_device_adapter_handle_t *hDevices, uint32_t Ada if (NULL == hDisplayOutput[DisplayIndex]) { - printf("hDisplayOutput[%d] is NULL.\n", DisplayIndex); + APP_LOG_ERROR("hDisplayOutput[%d] is NULL.", DisplayIndex); Result = CTL_RESULT_ERROR_INVALID_NULL_HANDLE; EXIT_ON_ERROR(Result); } @@ -673,7 +673,7 @@ ctl_result_t InitGenlockArgs(ctl_device_adapter_handle_t *hDevices, uint32_t Ada if ((CTL_GENLOCK_OPERATION_GET_TOPOLOGY != GenlockSampleArgs.Operation) && (0 == ActiveDisplayCount)) { - printf("Adatper[%d] does not have any active displays for the selected display type. ActiveDisplayCount is %d.\n", AdapterIndex, ActiveDisplayCount); + APP_LOG_ERROR("Adatper[%d] does not have any active displays for the selected display type. ActiveDisplayCount is %d.", AdapterIndex, ActiveDisplayCount); Result = CTL_RESULT_ERROR_DISPLAY_NOT_ATTACHED; EXIT_ON_ERROR(Result); } @@ -846,7 +846,7 @@ ctl_result_t GenlockDisable(ctl_device_adapter_handle_t *hDevices, uint32_t Adap if (0 == GenlockedAdapterCount) { - printf("There is no Genlocked adapter.\n"); + APP_LOG_ERROR("There is no Genlocked adapter."); Result = CTL_RESULT_ERROR_NOT_INITIALIZED; EXIT_ON_ERROR(Result); } @@ -1017,7 +1017,7 @@ int main(int Argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -1029,7 +1029,7 @@ int main(int Argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -1042,7 +1042,7 @@ int main(int Argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } if (true == IsGetVBlankTs) @@ -1060,6 +1060,6 @@ int main(int Argc, char *pArgv[]) ctlClose(hAPIHandle); CTL_FREE_MEM(hDevices); - printf("Overall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overall test result is 0x%X", GResult); return GResult; } diff --git a/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp b/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp index 6d60d6b..ab562b7 100644 --- a/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp +++ b/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp @@ -56,12 +56,12 @@ ctl_result_t TestToGetSetQuantizationRange(ctl_display_output_handle_t hDisplayO if ((FALSE == IsControllable) || (FALSE == IsSupported)) { - printf("Get/Set Quantization Range is not supported\n"); + APP_LOG_WARN("Get/Set Quantization Range is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("\n Current Applied Quantization Range is %d \n", AppliedDisplaySettings.QuantizationRange); + APP_LOG_INFO(" Current Applied Quantization Range is %d ", AppliedDisplaySettings.QuantizationRange); // SET CALL NewDisplaySettings.Version = API_VERSION; @@ -82,7 +82,7 @@ ctl_result_t TestToGetSetQuantizationRange(ctl_display_output_handle_t hDisplayO Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Quantization Range GET CALL)"); - printf("\n Current Quantization Range is %d \n", AppliedDisplaySettings.QuantizationRange); + APP_LOG_INFO(" Current Quantization Range is %d ", AppliedDisplaySettings.QuantizationRange); Exit: return Result; @@ -114,13 +114,13 @@ ctl_result_t TestToGetSetPictureAspectRatio(ctl_display_output_handle_t hDisplay if ((FALSE == IsControllable) || (FALSE == IsSupported)) { - printf("Get/Set PictureAspectRatio is not supported\n"); + APP_LOG_WARN("Get/Set PictureAspectRatio is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("\n Supported Picture Aspect Ratio is %d \n", AppliedDisplaySettings.SupportedPictureAR); - printf("\n Current Applied Picture Aspect Ratio is %d \n", AppliedDisplaySettings.PictureAR); + APP_LOG_INFO(" Supported Picture Aspect Ratio is %d ", AppliedDisplaySettings.SupportedPictureAR); + APP_LOG_INFO(" Current Applied Picture Aspect Ratio is %d ", AppliedDisplaySettings.PictureAR); // CALL TO SET 16_9 if (CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_16_9 & AppliedDisplaySettings.SupportedPictureAR) @@ -145,7 +145,7 @@ ctl_result_t TestToGetSetPictureAspectRatio(ctl_display_output_handle_t hDisplay Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Picture Aspect Ratio GET CALL)"); - printf("\n Current Picture Aspect Ratio is %d \n", AppliedDisplaySettings.PictureAR); + APP_LOG_INFO(" Current Picture Aspect Ratio is %d ", AppliedDisplaySettings.PictureAR); Exit: return Result; @@ -177,12 +177,12 @@ ctl_result_t TestToGetSetContentType(ctl_display_output_handle_t hDisplayOutput) if ((FALSE == IsControllable) || (FALSE == IsSupported)) { - printf("Get/Set ContentType is not supported\n"); + APP_LOG_WARN("Get/Set ContentType is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("\n Current Applied ContentType is %d \n", AppliedDisplaySettings.ContentType); + APP_LOG_INFO(" Current Applied ContentType is %d ", AppliedDisplaySettings.ContentType); // CALL TO SET GAMING CONTENT TYPE NewDisplaySettings.Version = API_VERSION; @@ -203,7 +203,7 @@ ctl_result_t TestToGetSetContentType(ctl_display_output_handle_t hDisplayOutput) Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (ContentType GET CALL)"); - printf("\n Current ContentType is %d \n", AppliedDisplaySettings.ContentType); + APP_LOG_INFO(" Current ContentType is %d ", AppliedDisplaySettings.ContentType); Exit: return Result; @@ -235,12 +235,12 @@ ctl_result_t TestToGetSetLowLatency(ctl_display_output_handle_t hDisplayOutput) if ((FALSE == IsControllable) || (FALSE == IsSupported)) { - printf("Get/Set LowLatency is not supported\n"); + APP_LOG_WARN("Get/Set LowLatency is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("\n Current Applied LowLatency is %d \n", AppliedDisplaySettings.LowLatency); + APP_LOG_INFO(" Current Applied LowLatency is %d ", AppliedDisplaySettings.LowLatency); // CALL TO ENABLE HDR10+ LOW_LATENCY NewDisplaySettings.Version = API_VERSION; @@ -261,7 +261,7 @@ ctl_result_t TestToGetSetLowLatency(ctl_display_output_handle_t hDisplayOutput) Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (LowLatency GET CALL)"); - printf("\n Current LowLatency is %d \n", AppliedDisplaySettings.LowLatency); + APP_LOG_INFO(" Current LowLatency is %d ", AppliedDisplaySettings.LowLatency); Exit: return Result; @@ -293,12 +293,12 @@ ctl_result_t TestToGetSetSourceTonemapping(ctl_display_output_handle_t hDisplayO if ((FALSE == IsControllable) || (FALSE == IsSupported)) { - printf("Get/Set SourceTM is not supported\n"); + APP_LOG_WARN("Get/Set SourceTM is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("\n Current Applied SourceTM is %d \n", AppliedDisplaySettings.SourceTM); + APP_LOG_INFO(" Current Applied SourceTM is %d ", AppliedDisplaySettings.SourceTM); // CALL TO ENABLE HDR10+ SOURCETM NewDisplaySettings.Version = API_VERSION; @@ -319,7 +319,7 @@ ctl_result_t TestToGetSetSourceTonemapping(ctl_display_output_handle_t hDisplayO Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (SourceTM GET CALL)"); - printf("\n Current SourceTM is %d \n", AppliedDisplaySettings.SourceTM); + APP_LOG_INFO(" Current SourceTM is %d ", AppliedDisplaySettings.SourceTM); Exit: return Result; @@ -354,7 +354,7 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput continue; } - printf("Attached Display Count: %d\n", DisplayIndex); + APP_LOG_INFO("Attached Display Count: %d", DisplayIndex); // Get/Set Quantization Range Result = TestToGetSetQuantizationRange(hDisplayOutput[DisplayIndex]); @@ -402,13 +402,13 @@ ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } else if (DisplayCount <= 0) { - printf("Invalid Display Count. skipping display enumration for adapter:%d\n", AdapterIndex); + APP_LOG_WARN("Invalid Display Count. skipping display enumration for adapter:%d", AdapterIndex); continue; } @@ -420,7 +420,7 @@ ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -430,7 +430,7 @@ ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateDisplayHandles returned failure code: 0x%X\n", Result); + APP_LOG_WARN("EnumerateDisplayHandles returned failure code: 0x%X", Result); } CTL_FREE_MEM(hDisplayOutput); @@ -473,7 +473,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -485,7 +485,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -498,14 +498,14 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } Result = EnumerateTargetDisplays(hDisplayOutput, AdapterCount, hDevices); if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateTargetDisplays returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateTargetDisplays returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -514,6 +514,6 @@ int main() ctlClose(hAPIHandle); CTL_FREE_MEM(hDisplayOutput); CTL_FREE_MEM(hDevices); - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } diff --git a/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp b/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp index ea42333..f4b0a8a 100644 --- a/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp +++ b/Samples/Edid_Management_Sample/Edid_Mgmt_Sample_App.cpp @@ -63,29 +63,29 @@ static std::vector EdidOverrideBuf = { ***************************************************************/ void PrintUsage(char *pArgv[]) { - printf("EDID Management Sample Test Application.\n"); - printf("\nUsage: %s [Operation] <-a Adapter#> <-t Target_ID> <-e Bin_Filename>\n", pArgv[0]); - printf("\nOperation\n"); - printf("\t'-lock' : Locks Monitor EDID\n"); - printf("\t'-unlock' : Unlock Previous Operation\n"); - printf("\t'-over' : Override EDID\n"); - printf("\t'-rem' : Remove EDID\n"); - printf("\t'-read' : Read Current Active EDID\n"); - printf("\t'-noaud' : Disable Display Audio. NOTE: You Must Specify an EDID binary\n"); - printf("\t'-help' : Display usage\n"); - printf("-a [Adapter #] : Optional Arg\n"); - printf("\tSpecify adapter number [min:0, max:4]\n"); - printf("\t0 (default) - applies to all adapters\n"); - printf("\t1 - applies to the first enumerated adapter\n"); - printf("\t2 - applies to the second enumerated adapter\n"); - printf("\t3 - applies to the third enumerated adapter\n"); - printf("\t4 - applies to the fourth enumerated adapter\n"); - printf("-t [Target ID] : Optional Arg\n"); - printf("\tSpecify Target ID in Hex. e.g '1040'\n"); - printf("-e [path\\to\\EDID binary file(read)] : Optional Arg\n"); - printf("\tSpecify EDID binary\n"); - printf("-we [path\\to\\EDID binary file(write)] : Optional Arg\n"); - printf("\tSpecify EDID binary\n"); + APP_LOG_INFO("EDID Management Sample Test Application."); + APP_LOG_INFO("Usage: %s [Operation] <-a Adapter#> <-t Target_ID> <-e Bin_Filename>", pArgv[0]); + APP_LOG_INFO("Operation"); + APP_LOG_INFO("\t'-lock' : Locks Monitor EDID"); + APP_LOG_INFO("\t'-unlock' : Unlock Previous Operation"); + APP_LOG_INFO("\t'-over' : Override EDID"); + APP_LOG_INFO("\t'-rem' : Remove EDID"); + APP_LOG_INFO("\t'-read' : Read Current Active EDID"); + APP_LOG_INFO("\t'-noaud' : Disable Display Audio. NOTE: You Must Specify an EDID binary"); + APP_LOG_INFO("\t'-help' : Display usage"); + APP_LOG_INFO("-a [Adapter #] : Optional Arg"); + APP_LOG_INFO("\tSpecify adapter number [min:0, max:4]"); + APP_LOG_INFO("\t0 (default) - applies to all adapters"); + APP_LOG_INFO("\t1 - applies to the first enumerated adapter"); + APP_LOG_INFO("\t2 - applies to the second enumerated adapter"); + APP_LOG_INFO("\t3 - applies to the third enumerated adapter"); + APP_LOG_INFO("\t4 - applies to the fourth enumerated adapter"); + APP_LOG_INFO("-t [Target ID] : Optional Arg"); + APP_LOG_INFO("\tSpecify Target ID in Hex. e.g '1040'"); + APP_LOG_INFO("-e [path\\to\\EDID binary file(read)] : Optional Arg"); + APP_LOG_INFO("\tSpecify EDID binary"); + APP_LOG_INFO("-we [path\\to\\EDID binary file(write)] : Optional Arg"); + APP_LOG_INFO("\tSpecify EDID binary"); } /*************************************************************** @@ -107,13 +107,13 @@ bool WriteEdidToFile(uint8_t *const pEdidBuf, uint32_t EdidSize) fclose(pFile); if (BytesWritten != (1 * EdidSize)) { - printf("Number of bytes differ when writing Edid binary file.\n"); + APP_LOG_ERROR("Number of bytes differ when writing Edid binary file."); return false; } } else { - printf("Failure opening Edid binary file for writing.\n"); + APP_LOG_ERROR("Failure opening Edid binary file for writing."); return false; } @@ -228,8 +228,8 @@ uint32_t RemoveAudioCapsFromEdid(uint8_t *pEdidBuf, uint32_t EdidSize) } } - printf("Number of Audio blocks removed from Edid = %d.\n", NumAudioBlocksRemoved); - printf("Number of Basic Audio flags disabled in Edid = %d.\n", NumCeaV3ExtensionsFound); + APP_LOG_INFO("Number of Audio blocks removed from Edid = %d.", NumAudioBlocksRemoved); + APP_LOG_INFO("Number of Basic Audio flags disabled in Edid = %d.", NumCeaV3ExtensionsFound); return NumAudioBlocksRemoved; } @@ -263,7 +263,7 @@ ctl_result_t EdidMgmtApi(ctl_display_output_handle_t hDisplayOutput, const ctl_e if ((EdidMgmtArgs.OutFlags & CTL_EDID_MANAGEMENT_OUT_FLAG_DISPLAY_CONNECTED) != 0) { - printf("info: Out flags : Physical Display is connected.\n"); + APP_LOG_INFO("Out flags : Physical Display is connected."); } if (CTL_EDID_MANAGEMENT_OPTYPE_READ_EDID == OpType) @@ -272,33 +272,33 @@ ctl_result_t EdidMgmtApi(ctl_display_output_handle_t hDisplayOutput, const ctl_e if (pEdidSz) { *pEdidSz = EdidMgmtArgs.EdidSize; - printf("EDID Size %d.\n", EdidMgmtArgs.EdidSize); + APP_LOG_INFO("EDID Size %d.", EdidMgmtArgs.EdidSize); } if (pEdidBuf) { if (DisableAudioInEdid) { - printf("Attempting to remove audio from Edid...\n"); + APP_LOG_INFO("Attempting to remove audio from Edid..."); if (0 == RemoveAudioCapsFromEdid(pEdidBuf, EdidMgmtArgs.EdidSize)) { if (NumCeaV3ExtensionsFound) { - printf("Audio descriptor blocks not found and only Basic Audio was removed from Edid,\n"); - printf("so override operations may fail to disable monitor audio.\n"); + APP_LOG_WARN("Audio descriptor blocks not found and only Basic Audio was removed from Edid,"); + APP_LOG_WARN("so override operations may fail to disable monitor audio."); } else { - printf("No CEA Extensions found in Edid, binary file will fail to disable monitor audio\n"); + APP_LOG_ERROR("No CEA Extensions found in Edid, binary file will fail to disable monitor audio"); } } } if (WriteBinaryFile) { - printf("Writing binary file: %s\n", EdidBinFileName); + APP_LOG_INFO("Writing binary file: %s", EdidBinFileName); if (false == WriteEdidToFile(pEdidBuf, EdidMgmtArgs.EdidSize)) { - printf("Failure writing Edid binary file.\n"); + APP_LOG_ERROR("Failure writing Edid binary file."); } } @@ -307,26 +307,26 @@ ctl_result_t EdidMgmtApi(ctl_display_output_handle_t hDisplayOutput, const ctl_e { if (0 == (j % 16)) // Format EDID to make it easier to analyze { - printf("\n"); + PRINT_LOGS(" "); } - printf("0x%02X ", pEdidBuf[j]); + APP_LOG_INFO("0x%02X ", pEdidBuf[j]); } - printf("\n"); + PRINT_LOGS(" "); } if ((EdidMgmtArgs.OutFlags & CTL_EDID_MANAGEMENT_OUT_FLAG_SUPPLIED_EDID) != 0) { - printf("info: Out flags : Current EDID is IGCL Supplied.\n"); + APP_LOG_INFO("Out flags : Current EDID is IGCL Supplied."); } else if ((EdidMgmtArgs.OutFlags & CTL_EDID_MANAGEMENT_OUT_FLAG_MONITOR_EDID) != 0) { - printf("info: Out flags : Current EDID is Monitor Data.\n"); + APP_LOG_INFO("Out flags : Current EDID is Monitor Data."); } } // wait based on out flag, to allow time for Config Switches by OS if ((EdidMgmtArgs.OutFlags & CTL_EDID_MANAGEMENT_OUT_FLAG_OS_CONN_NOTIFICATION) != 0) { - printf("info: Waiting for 5 secs to allow any OS Config Switch.\n"); + APP_LOG_INFO("Waiting for 5 secs to allow any OS Config Switch."); Sleep(5000); } return Result; @@ -346,8 +346,8 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ uint8_t *pEdidBuf = nullptr; bool IsDisplayAttached = (0 != (DisplayProperties.DisplayConfigFlags & CTL_DISPLAY_CONFIG_FLAG_DISPLAY_ATTACHED)); - printf("Info: Start EDID Management Tests for TargetID: %x, Type %d, Config 0x%x, DisplayMuxType %d, PConOutType %d.\n", DisplayProperties.Os_display_encoder_handle.WindowsDisplayEncoderID, - DisplayProperties.Type, DisplayProperties.DisplayConfigFlags, DisplayProperties.AttachedDisplayMuxType, DisplayProperties.ProtocolConverterOutput); + APP_LOG_INFO("Start EDID Management Tests for TargetID: %x, Type %d, Config 0x%x, DisplayMuxType %d, PConOutType %d.", DisplayProperties.Os_display_encoder_handle.WindowsDisplayEncoderID, + DisplayProperties.Type, DisplayProperties.DisplayConfigFlags, DisplayProperties.AttachedDisplayMuxType, DisplayProperties.ProtocolConverterOutput); if (TgtId > 0) // individual display control { // Below operations possible on detached target @@ -365,23 +365,23 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, &EdidOverrideBuf[0]); } LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:LOCK supplied EDID"); - printf("Info: Passed Test Lock supplied EDID.\n"); + APP_LOG_INFO("Passed Test Lock supplied EDID."); break; case CTL_EDID_MANAGEMENT_OPTYPE_UNLOCK_EDID: Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_UNLOCK_EDID); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:UNLOCK EDID"); - printf("Info: Passed Test Unlock EDID.\n"); + APP_LOG_INFO("Passed Test Unlock EDID."); break; case CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID: EdidSize = static_cast(EdidOverrideBuf.size()); Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, &EdidOverrideBuf[0]); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:override EDID"); - printf("Info: Passed Test override EDID.\n"); + APP_LOG_INFO("Passed Test override EDID."); break; case CTL_EDID_MANAGEMENT_OPTYPE_UNDO_OVERRIDE_EDID: Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_UNDO_OVERRIDE_EDID); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:remove EDID"); - printf("Info: Passed Test remove overridden EDID.\n"); + APP_LOG_INFO("Passed Test remove overridden EDID."); break; case CTL_EDID_MANAGEMENT_OPTYPE_READ_EDID: // Pass 1: read EDID size @@ -393,7 +393,7 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ EXIT_ON_MEM_ALLOC_FAILURE(pEdidBuf, "pEdidBuf"); Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_READ_EDID, CTL_EDID_TYPE_CURRENT, &EdidSize, pEdidBuf); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:READ EDID 2"); - printf("\nInfo: Passed Test read EDID.\n"); + APP_LOG_INFO("Passed Test read EDID."); break; default: break; @@ -413,14 +413,14 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID, CTL_EDID_TYPE_MONITOR); } LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:LOCK Monitor EDID"); - printf("Info: Passed Test Lock Monitor EDID.\n"); + APP_LOG_INFO("Passed Test Lock Monitor EDID."); } if (CTL_EDID_MANAGEMENT_OPTYPE_UNLOCK_EDID == EdidMgmtOpType || CTL_EDID_MANAGEMENT_OPTYPE_MAX == EdidMgmtOpType) { Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_UNLOCK_EDID); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:UNLOCK EDID"); - printf("Info: Passed Test Unlock EDID.\n"); + APP_LOG_INFO("Passed Test Unlock EDID."); } if (CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID == EdidMgmtOpType || CTL_EDID_MANAGEMENT_OPTYPE_MAX == EdidMgmtOpType) @@ -428,7 +428,7 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ EdidSize = static_cast(EdidOverrideBuf.size()); Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_OVERRIDE_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, &EdidOverrideBuf[0]); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:override EDID"); - printf("Info: Passed Test override EDID.\n"); + APP_LOG_INFO("Passed Test override EDID."); } if (CTL_EDID_MANAGEMENT_OPTYPE_READ_EDID == EdidMgmtOpType || CTL_EDID_MANAGEMENT_OPTYPE_MAX == EdidMgmtOpType) @@ -444,7 +444,7 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:READ EDID 2"); CTL_FREE_MEM(pEdidBuf); - printf("\nInfo: Passed Test read EDID.\n"); + APP_LOG_INFO("Passed Test read EDID."); } if (CTL_EDID_MANAGEMENT_OPTYPE_UNDO_OVERRIDE_EDID == EdidMgmtOpType || CTL_EDID_MANAGEMENT_OPTYPE_MAX == EdidMgmtOpType) @@ -464,7 +464,7 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:READ EDID 2"); CTL_FREE_MEM(pEdidBuf); - printf("\nInfo: Passed Test remove overridden EDID.\n"); + APP_LOG_INFO("Passed Test remove overridden EDID."); } // When ran the app w/o any commandline args, // test EDID lock with Supplied EDID. For demo purpose. @@ -473,17 +473,17 @@ ctl_result_t TestEDIDManagement(ctl_display_output_handle_t hDisplayOutput, ctl_ EdidSize = static_cast(EdidOverrideBuf.size()); Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_LOCK_EDID, CTL_EDID_TYPE_OVERRIDE, &EdidSize, &EdidOverrideBuf[0]); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:LOCK supplied EDID"); - printf("Info: Passed Test Lock supplied EDID.\n"); + APP_LOG_INFO("Passed Test Lock supplied EDID."); // unlock display Result = EdidMgmtApi(hDisplayOutput, CTL_EDID_MANAGEMENT_OPTYPE_UNLOCK_EDID); LOG_AND_EXIT_ON_ERROR(Result, "ctlEdidManagement:UNLOCK EDID"); - printf("Info: Passed Test Unlock EDID.\n"); + APP_LOG_INFO("Passed Test Unlock EDID."); } } Exit: - printf("Info: Exit EDID Management Tests for TargetID: %x.\n\n", DisplayProperties.Os_display_encoder_handle.WindowsDisplayEncoderID); + APP_LOG_INFO("Exit EDID Management Tests for TargetID: %x.", DisplayProperties.Os_display_encoder_handle.WindowsDisplayEncoderID); CTL_FREE_MEM(pEdidBuf); return Result; } @@ -550,13 +550,13 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } else if (DisplayCount <= 0) { - printf("Invalid Display Count. skipping display enumration for adapter:%d\n", AdapterIndex); + APP_LOG_WARN("Invalid Display Count. skipping display enumration for adapter:%d", AdapterIndex); continue; } @@ -567,7 +567,7 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } @@ -578,7 +578,7 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateDisplayHandles returned failure code: 0x%X\n", Result); + APP_LOG_WARN("EnumerateDisplayHandles returned failure code: 0x%X", Result); } CTL_FREE_MEM(hDisplayOutput); @@ -646,7 +646,7 @@ int main(int32_t Argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Get a handle to the DLL module. @@ -695,13 +695,13 @@ int main(int32_t Argc, char *pArgv[]) { if (!isdigit(OptionArg[Index])) { - printf("Invalid Adapter Number.\n"); + APP_LOG_ERROR("Invalid Adapter Number."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } } AdapterNumber = stoul(OptionArg, 0, 16); - printf("Adapter Number: %d\n", AdapterNumber); + APP_LOG_INFO("Adapter Number: %d", AdapterNumber); } } // Target ID option @@ -713,13 +713,13 @@ int main(int32_t Argc, char *pArgv[]) { if (!isxdigit(OptionArg[Index])) { - printf("Invalid Target ID.\n"); + APP_LOG_ERROR("Invalid Target ID."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } } TgtId = stoul(OptionArg, 0, 16); - printf("Test or Target ID: 0x%X\n", TgtId); + APP_LOG_INFO("Test or Target ID: 0x%X", TgtId); } } @@ -733,10 +733,10 @@ int main(int32_t Argc, char *pArgv[]) switch (EdidMgmtOpType) { case CTL_EDID_MANAGEMENT_OPTYPE_UNDO_OVERRIDE_EDID: - printf("Info: Ignoring write of binary file for Undo Override operation.\n"); + APP_LOG_WARN("Ignoring write of binary file for Undo Override operation."); break; case CTL_EDID_MANAGEMENT_OPTYPE_UNLOCK_EDID: - printf("Info: Ignoring write of binary file for Unlock operation.\n"); + APP_LOG_WARN("Ignoring write of binary file for Unlock operation."); break; default: ZeroMemory(&EdidBinFileName, sizeof(EdidBinFileName)); @@ -747,7 +747,7 @@ int main(int32_t Argc, char *pArgv[]) } else { - printf("Failed to write the EDID binary file - NULL filename.\n"); + APP_LOG_ERROR("Failed to write the EDID binary file - NULL filename."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } @@ -759,10 +759,10 @@ int main(int32_t Argc, char *pArgv[]) switch (EdidMgmtOpType) { case CTL_EDID_MANAGEMENT_OPTYPE_UNDO_OVERRIDE_EDID: - printf("Info: Ignoring read of binary file for Undo Override operation.\n"); + APP_LOG_WARN("Ignoring read of binary file for Undo Override operation."); break; case CTL_EDID_MANAGEMENT_OPTYPE_UNLOCK_EDID: - printf("Info: Ignoring read of binary file for Unlock operation.\n"); + APP_LOG_WARN("Ignoring read of binary file for Unlock operation."); break; default: try @@ -774,7 +774,7 @@ int main(int32_t Argc, char *pArgv[]) if (false == EdidFile.is_open()) { - printf("Cannot open a EDID file.\n"); + APP_LOG_ERROR("Cannot open a EDID file."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } @@ -790,14 +790,14 @@ int main(int32_t Argc, char *pArgv[]) } catch (const std::ios_base::failure &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } break; } } else { - printf("Failed to find the EDID binary file.\n"); + APP_LOG_ERROR("Failed to find the EDID binary file."); Result = CTL_RESULT_ERROR_INVALID_ARGUMENT; EXIT_ON_ERROR(Result); } @@ -812,7 +812,7 @@ int main(int32_t Argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -825,21 +825,21 @@ int main(int32_t Argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } Result = EnumerateTargetDisplays(AdapterCount, hDevices); if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateTargetDisplays returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateTargetDisplays returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } Exit: ctlClose(hAPIHandle); CTL_FREE_MEM(hDevices); - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } diff --git a/Samples/Generic_Sample/Sample_ControlAPP.cpp b/Samples/Generic_Sample/Sample_ControlAPP.cpp index 107414b..46c853e 100644 --- a/Samples/Generic_Sample/Sample_ControlAPP.cpp +++ b/Samples/Generic_Sample/Sample_ControlAPP.cpp @@ -682,6 +682,7 @@ void PrintAdapterProperties(ctl_device_adapter_properties_t *pStDeviceAdapterPro printf("num_eus_per_sub_slice: %d\n", pStDeviceAdapterProperties->num_eus_per_sub_slice); printf("num_slices: %d\n", pStDeviceAdapterProperties->num_slices); printf("num_sub_slices_per_slice: %d\n", pStDeviceAdapterProperties->num_sub_slices_per_slice); + printf("num_xe_cores: %d\n", pStDeviceAdapterProperties->num_xe_cores); printf("Graphics HW type: %s\n", pStDeviceAdapterProperties->graphics_adapter_properties & CTL_ADAPTER_PROPERTIES_FLAG_INTEGRATED ? "Integrated" : "External GFX"); if ((INVALID_ADAPTER_BDF == pStDeviceAdapterProperties->adapter_bdf.bus) && (INVALID_ADAPTER_BDF == pStDeviceAdapterProperties->adapter_bdf.device) && @@ -804,7 +805,7 @@ ctl_result_t CtlAdapterTesting(ctl_device_adapter_handle_t *hDevices, uint32_t A StDeviceAdapterProperties.Size = sizeof(ctl_device_adapter_properties_t); StDeviceAdapterProperties.pDeviceID = malloc(sizeof(LUID)); StDeviceAdapterProperties.device_id_size = sizeof(LUID); - StDeviceAdapterProperties.Version = 2; + StDeviceAdapterProperties.Version = 3; for (Index = 0; Index < Adapter_count; Index++) { diff --git a/Samples/Overclocking_Sample/README.md b/Samples/Overclocking_Sample/README.md index b3c7097..9e05a42 100644 --- a/Samples/Overclocking_Sample/README.md +++ b/Samples/Overclocking_Sample/README.md @@ -1 +1 @@ -Sample Application for the Overclocking interface \ No newline at end of file +Sample Application for the Overclocking interface with Overclocking V2 APIs \ No newline at end of file diff --git a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp index 8a2d9f6..e4ec8cf 100644 --- a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp +++ b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp @@ -22,16 +22,10 @@ #include #include #include - -#include #include - -#include -#include #include "igcl_api.h" #include "GenericIGCLApp.h" - -std::string DecodeRetCode(ctl_result_t Res); +#include void OverclockProperties(ctl_device_adapter_handle_t hDAhandle); void OverclockFrequencyOffset(ctl_device_adapter_handle_t hDAhandle); @@ -39,167 +33,119 @@ void OverclockVoltageOffset(ctl_device_adapter_handle_t hDAhandle); void OverclockLockFrequency(ctl_device_adapter_handle_t hDAhandle); void OverclockPowerLimit(ctl_device_adapter_handle_t hDAhandle); void OverclockTemperatureLimit(ctl_device_adapter_handle_t hDAhandle); +void OverclockVramMemSpeedLimit(ctl_device_adapter_handle_t hDAhandle); +void OverclockVFCurveReadWrite(ctl_device_adapter_handle_t hDAhandle); void OverclockPowerTelemetry(ctl_device_adapter_handle_t hDAhandle); -const char *printType(ctl_data_type_t Type) +std::string printType(ctl_data_type_t Type) { - switch (Type) + static const std::map dataTypeStringMap = { { CTL_DATA_TYPE_INT8, "INT8" }, + { CTL_DATA_TYPE_UINT8, "UINT8" }, + { CTL_DATA_TYPE_INT16, "INT16" }, + { CTL_DATA_TYPE_UINT16, "UINT16" }, + { CTL_DATA_TYPE_INT32, "INT32" }, + { CTL_DATA_TYPE_UINT32, "UINT32" }, + { CTL_DATA_TYPE_INT64, "INT64" }, + { CTL_DATA_TYPE_UINT64, "UINT64" }, + { CTL_DATA_TYPE_FLOAT, "FLOAT" }, + { CTL_DATA_TYPE_DOUBLE, "DOUBLE" }, + { CTL_DATA_TYPE_STRING_ASCII, "STRING_ASCII" }, + { CTL_DATA_TYPE_STRING_UTF16, "STRING_UTF16" }, + { CTL_DATA_TYPE_STRING_UTF132, "STRING_UTF132" } }; + + auto it = dataTypeStringMap.find(Type); + if (it != dataTypeStringMap.end()) { - case ctl_data_type_t::CTL_DATA_TYPE_INT8: - { - return "CTL_DATA_TYPE_INT8"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_UINT8: - { - return "CTL_DATA_TYPE_UINT8"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_INT16: - { - return "CTL_DATA_TYPE_INT16"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_UINT16: - { - return "CTL_DATA_TYPE_UINT16"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_INT32: - { - return "CTL_DATA_TYPE_INT32"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_UINT32: - { - return "CTL_DATA_TYPE_UINT32"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_INT64: - { - return "CTL_DATA_TYPE_INT64"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_UINT64: - { - return "CTL_DATA_TYPE_UINT64"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_FLOAT: - { - return "CTL_DATA_TYPE_FLOAT"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_DOUBLE: - { - return "CTL_DATA_TYPE_DOUBLE"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_STRING_ASCII: - { - return "CTL_DATA_TYPE_STRING_ASCII"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_STRING_UTF16: - { - return "CTL_DATA_TYPE_STRING_UTF16"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_STRING_UTF132: - { - return "CTL_DATA_TYPE_STRING_UTF132"; - } - break; - default: - return "Unknown units"; + return it->second; } + return "Unknown datatype"; } -const char *printUnits(ctl_units_t Units) +std::string printUnits(ctl_units_t Units) { - switch (Units) + static const std::map unitsStringMap = { { CTL_UNITS_FREQUENCY_MHZ, "Frequency in MHz" }, + { CTL_UNITS_OPERATIONS_GTS, "GigaOperations per Second" }, + { CTL_UNITS_OPERATIONS_MTS, "MegaOperations per Second" }, + { CTL_UNITS_VOLTAGE_VOLTS, "Voltage in Volts" }, + { CTL_UNITS_POWER_WATTS, "Power in Watts" }, + { CTL_UNITS_TEMPERATURE_CELSIUS, "Temperature in Celsius" }, + { CTL_UNITS_ENERGY_JOULES, "Energy in Joules" }, + { CTL_UNITS_TIME_SECONDS, "Time in Seconds" }, + { CTL_UNITS_MEMORY_BYTES, "Memory in Bytes" }, + { CTL_UNITS_ANGULAR_SPEED_RPM, "Angular Speed in RPM" }, + { CTL_UNITS_POWER_MILLIWATTS, "Power in Milli Watts" }, + { CTL_UNITS_PERCENT, "Units in Percentage" }, + { CTL_UNITS_MEM_SPEED_GBPS, "Units in Gigabyte Per Second" }, + { CTL_UNITS_VOLTAGE_MILLIVOLTS, "Voltage in MilliVolts" }, + { CTL_UNITS_BANDWIDTH_MBPS, "Bandwidth in MegaBytes Per Second" } }; + + auto it = unitsStringMap.find(Units); + if (it != unitsStringMap.end()) { - case ctl_units_t::CTL_UNITS_FREQUENCY_MHZ: - { - return "Frequency in MHz"; - } - break; - case ctl_units_t::CTL_UNITS_OPERATIONS_GTS: - { - return "GigaOperations per Second"; - } - break; - case ctl_units_t::CTL_UNITS_OPERATIONS_MTS: - { - return "MegaOperations per Second"; - } - break; - case ctl_units_t::CTL_UNITS_VOLTAGE_VOLTS: - { - return "Voltage in Volts"; - } - break; - case ctl_units_t::CTL_UNITS_POWER_WATTS: - { - return "Power in Watts"; - } - break; - case ctl_units_t::CTL_UNITS_TEMPERATURE_CELSIUS: - { - return "Temperature in Celsius"; - } - break; - case ctl_units_t::CTL_UNITS_ENERGY_JOULES: - { - return "Energy in Joules"; - } - break; - case ctl_units_t::CTL_UNITS_TIME_SECONDS: - { - return "Time in Seconds"; - } - break; - case ctl_units_t::CTL_UNITS_MEMORY_BYTES: - { - return "Memory in Bytes"; - } - break; - case ctl_units_t::CTL_UNITS_ANGULAR_SPEED_RPM: - { - return "Angular Speed in RPM"; - } - break; - case ctl_units_t::CTL_UNITS_POWER_MILLIWATTS: - { - return "Power in Milli Watts"; - } - break; - case ctl_units_t::CTL_UNITS_PERCENT: - { - return "Units in Percentage"; - } - break; - case ctl_units_t::CTL_UNITS_MEM_SPEED_GBPS: - { - return "Units in Gigabyte Per Second"; - } - break; - case ctl_units_t::CTL_UNITS_VOLTAGE_MILLIVOLTS: - { - return "Voltage in MilliVolts"; - } - case ctl_units_t::CTL_UNITS_BANDWIDTH_MBPS: - { - return "Bandwidth in MegaBytes Per Second"; - } - break; - default: - return "Unknown units"; + return it->second; } + return "Unknown unit"; +} + +std::string printVFCurveDetails(ctl_vf_curve_details_t VFCurveDetails) +{ + static const std::map vfCurveDetailsMap = { { CTL_VF_CURVE_DETAILS_SIMPLIFIED, "[CTL_VF_CURVE_DETAILS_SIMPLIFIED]" }, + { CTL_VF_CURVE_DETAILS_MEDIUM, "[CTL_VF_CURVE_DETAILS_MEDIUM]" }, + { CTL_VF_CURVE_DETAILS_ELABORATE, "[CTL_VF_CURVE_DETAILS_ELABORATE]" } }; + + auto it = vfCurveDetailsMap.find(VFCurveDetails); + if (it != vfCurveDetailsMap.end()) + { + return it->second; + } + return "Unknown vfcurvedetails"; +} + +// Decoding the return code for the most common error codes. +std::string DecodeRetCode(ctl_result_t Res) +{ + static const std::map retCodeMap = { { CTL_RESULT_SUCCESS, "[CTL_RESULT_SUCCESS]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE]" }, + { CTL_RESULT_ERROR_GENERIC_START, "[CTL_RESULT_ERROR_GENERIC_START]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET]" }, + { CTL_RESULT_ERROR_NOT_INITIALIZED, "[CTL_RESULT_ERROR_NOT_INITIALIZED]" }, + { CTL_RESULT_ERROR_ALREADY_INITIALIZED, "[CTL_RESULT_ERROR_ALREADY_INITIALIZED]" }, + { CTL_RESULT_ERROR_DEVICE_LOST, "[CTL_RESULT_ERROR_DEVICE_LOST]" }, + { CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS, "[CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS]" }, + { CTL_RESULT_ERROR_NOT_AVAILABLE, "[CTL_RESULT_ERROR_NOT_AVAILABLE]" }, + { CTL_RESULT_ERROR_UNINITIALIZED, "[CTL_RESULT_ERROR_UNINITIALIZED]" }, + { CTL_RESULT_ERROR_UNSUPPORTED_VERSION, "[CTL_RESULT_ERROR_UNSUPPORTED_VERSION]" }, + { CTL_RESULT_ERROR_UNSUPPORTED_FEATURE, "[CTL_RESULT_ERROR_UNSUPPORTED_FEATURE]" }, + { CTL_RESULT_ERROR_INVALID_ARGUMENT, "[CTL_RESULT_ERROR_INVALID_ARGUMENT]" }, + { CTL_RESULT_ERROR_INVALID_NULL_HANDLE, "[CTL_RESULT_ERROR_INVALID_NULL_HANDLE]" }, + { CTL_RESULT_ERROR_INVALID_NULL_POINTER, "[CTL_RESULT_ERROR_INVALID_NULL_POINTER]" }, + { CTL_RESULT_ERROR_INVALID_SIZE, "[CTL_RESULT_ERROR_INVALID_SIZE]" }, + { CTL_RESULT_ERROR_UNSUPPORTED_SIZE, "[CTL_RESULT_ERROR_UNSUPPORTED_SIZE]" }, + { CTL_RESULT_ERROR_NOT_IMPLEMENTED, "[CTL_RESULT_ERROR_NOT_IMPLEMENTED]" }, + { CTL_RESULT_ERROR_ZE_LOADER, "[CTL_RESULT_ERROR_ZE_LOADER]" }, + { CTL_RESULT_ERROR_INVALID_OPERATION_TYPE, "[CTL_RESULT_ERROR_INVALID_OPERATION_TYPE]" }, + { CTL_RESULT_ERROR_DATA_READ, "[CTL_RESULT_ERROR_DATA_READ]" }, + { CTL_RESULT_ERROR_DATA_WRITE, "[CTL_RESULT_ERROR_DATA_WRITE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_INVALID_CUSTOM_VF_CURVE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_INVALID_CUSTOM_VF_CURVE]" }, + { CTL_RESULT_ERROR_UNKNOWN, "[CTL_RESULT_ERROR_UNKNOWN]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_DEPRECATED_API, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_DEPRECATED_API]" } }; + + auto it = retCodeMap.find(Res); + if (it != retCodeMap.end()) + { + return it->second; + } + return "[Unknown Error]"; } /*************************************************************** - * @brief + * @brief OverclockProperties * Overclock Properties: The function ctlOverclockGetProperties * retrieves all the necessary information to populate a GUI. For * each property the following is provided: @@ -218,223 +164,237 @@ void OverclockProperties(ctl_device_adapter_handle_t hDAhandle) { ctl_oc_properties_t OcProperties = {}; OcProperties.Size = sizeof(ctl_oc_properties_t); + OcProperties.Version = 1; ctl_result_t Status = ctlOverclockGetProperties(hDAhandle, &OcProperties); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nError: %s", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockProperties => ctlOverclockGetProperties Error: %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } // Is Overclocking supported by this adapter? PRINT_LOGS("\nOc Supported? %s", OcProperties.bSupported ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Max: %f\n", OcProperties.gpuFrequencyOffset.max); // Slider for frequency offset PRINT_LOGS("\nGpu Frequency Offset Supported? %s ", OcProperties.gpuFrequencyOffset.bSupported ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Supported? %s", OcProperties.gpuFrequencyOffset.bSupported ? "true" : "false"); PRINT_LOGS("\nGpu Frequency Offset Is Relative? %s", OcProperties.gpuFrequencyOffset.bRelative ? "true" : "false"); PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Default: %f", OcProperties.gpuFrequencyOffset.Default); - PRINT_LOGS("\nGpu Frequency Offset Min: %f", OcProperties.gpuFrequencyOffset.min); - PRINT_LOGS("\nGpu Frequency Offset Max: %f", OcProperties.gpuFrequencyOffset.max); - PRINT_LOGS("\nGpu Frequency Offset Reference: %f", OcProperties.gpuFrequencyOffset.reference); - PRINT_LOGS("\nGpu Frequency Offset Step: %f", OcProperties.gpuFrequencyOffset.step); - PRINT_LOGS("\nGpu Frequency Offset Units:: %s\n", printUnits(OcProperties.gpuFrequencyOffset.units)); + PRINT_LOGS("\nGpu Frequency Offset Default: %lf", OcProperties.gpuFrequencyOffset.Default); + PRINT_LOGS("\nGpu Frequency Offset Min: %lf", OcProperties.gpuFrequencyOffset.min); + PRINT_LOGS("\nGpu Frequency Offset Max: %lf", OcProperties.gpuFrequencyOffset.max); + PRINT_LOGS("\nGpu Frequency Offset Reference: %lf", OcProperties.gpuFrequencyOffset.reference); + PRINT_LOGS("\nGpu Frequency Offset Step: %lf", OcProperties.gpuFrequencyOffset.step); + PRINT_LOGS("\nGpu Frequency Offset Units:: %s\n", printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); // Slider for voltage offset - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Voltage Offset Default: %f", OcProperties.gpuVoltageOffset.Default); - PRINT_LOGS("\n Gpu Voltage Offset Min : %f", OcProperties.gpuVoltageOffset.min); - PRINT_LOGS("\nGpu Voltage Offset Max: %f", OcProperties.gpuVoltageOffset.max); - PRINT_LOGS("\nGpu Voltage Offset Reference: %f", OcProperties.gpuVoltageOffset.reference); - PRINT_LOGS("\nGpu Voltage Offset Step: %f", OcProperties.gpuVoltageOffset.step); - PRINT_LOGS("\nGpu Voltage Offset Units: %s\n", printUnits(OcProperties.gpuVoltageOffset.units)); - - // Slider for VRAM frequency offset - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nVRAM Frequency Offset Default: %f", OcProperties.vramFrequencyOffset.Default); - PRINT_LOGS("\nVRAM Frequency Offset Min : %f", OcProperties.vramFrequencyOffset.min); - PRINT_LOGS("\nVRAM Frequency Offset Max: %f", OcProperties.vramFrequencyOffset.max); - PRINT_LOGS("\nVRAM Frequency Offset Reference: %f", OcProperties.vramFrequencyOffset.reference); - PRINT_LOGS("\nVRAM Frequency Offset Step: %f", OcProperties.vramFrequencyOffset.step); - PRINT_LOGS("\nVRAM Frequency Offset Units: %s\n", printUnits(OcProperties.vramFrequencyOffset.units)); - - // Slider for VRAM voltage offset - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nVRAM Voltage Offset Default: %f", OcProperties.vramVoltageOffset.Default); - PRINT_LOGS("\nVRAM Voltage Offset Min: %f", OcProperties.vramVoltageOffset.min); - PRINT_LOGS("\nVRAM Voltage Offset Max: %f", OcProperties.vramVoltageOffset.max); - PRINT_LOGS("\nVRAM Voltage Offset Reference : %f", OcProperties.vramVoltageOffset.reference); - PRINT_LOGS("\nVRAM Voltage Offset Step: %f", OcProperties.vramVoltageOffset.step); - PRINT_LOGS("\nVRAM Voltage Offset Units: %s\n", printUnits(OcProperties.vramVoltageOffset.units)); + PRINT_LOGS("\nGpu Voltage Offset Supported? %s ", OcProperties.gpuVoltageOffset.bSupported ? "true" : "false"); + PRINT_LOGS("\nGpu Voltage Offset Is Relative? %s", OcProperties.gpuVoltageOffset.bRelative ? "true" : "false"); + PRINT_LOGS("\nGpu Voltage Offset Have Reference? %s", OcProperties.gpuVoltageOffset.bReference ? "true" : "false"); + PRINT_LOGS("\nGpu Voltage Offset Default: %lf", OcProperties.gpuVoltageOffset.Default); + PRINT_LOGS("\nGpu Voltage Offset Min : %lf", OcProperties.gpuVoltageOffset.min); + PRINT_LOGS("\nGpu Voltage Offset Max: %lf", OcProperties.gpuVoltageOffset.max); + PRINT_LOGS("\nGpu Voltage Offset Reference: %lf", OcProperties.gpuVoltageOffset.reference); + PRINT_LOGS("\nGpu Voltage Offset Step: %lf", OcProperties.gpuVoltageOffset.step); + PRINT_LOGS("\nGpu Voltage Offset Units: %s\n", printUnits(OcProperties.gpuVoltageOffset.units).c_str()); + + // Slider for VRAM Mem Speed Limit + PRINT_LOGS("\nVram Memory Speed Limit Supported? %s ", OcProperties.vramMemSpeedLimit.bSupported ? "true" : "false"); + PRINT_LOGS("\nVram Memory Speed Limit Is Relative? %s", OcProperties.vramMemSpeedLimit.bRelative ? "true" : "false"); + PRINT_LOGS("\nVram Memory Speed Limit Have Reference? %s", OcProperties.vramMemSpeedLimit.bReference ? "true" : "false"); + PRINT_LOGS("\nVram Memory Speed Limit Default: %lf", OcProperties.vramMemSpeedLimit.Default); + PRINT_LOGS("\nVram Memory Speed Limit Min : %lf", OcProperties.vramMemSpeedLimit.min); + PRINT_LOGS("\nVram Memory Speed Limit Max: %lf", OcProperties.vramMemSpeedLimit.max); + PRINT_LOGS("\nVram Memory Speed Limit Reference: %lf", OcProperties.vramMemSpeedLimit.reference); + PRINT_LOGS("\nVram Memory Speed Limit Step: %lf", OcProperties.vramMemSpeedLimit.step); + PRINT_LOGS("\nVram Memory Speed Limit Units: %s\n", printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); // Slider for Power Limit - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("G\npu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nPower Limit Default: %f", OcProperties.powerLimit.Default); - PRINT_LOGS("\nPower Limit Min: %f", OcProperties.powerLimit.min); - PRINT_LOGS("\nPower Limit Max: %f", OcProperties.powerLimit.max); - PRINT_LOGS("\nPower Limit Reference: %f", OcProperties.powerLimit.reference); - PRINT_LOGS("\nPower Limit Step: %f", OcProperties.powerLimit.step); - PRINT_LOGS("\nPower Limit Units: %s\n", printUnits(OcProperties.powerLimit.units)); + PRINT_LOGS("\nPower Limit Supported? %s ", OcProperties.powerLimit.bSupported ? "true" : "false"); + PRINT_LOGS("\nPower Limit Is Relative? %s", OcProperties.powerLimit.bRelative ? "true" : "false"); + PRINT_LOGS("\nPower Limit Have Reference? %s", OcProperties.powerLimit.bReference ? "true" : "false"); + PRINT_LOGS("\nPower Limit Default: %lf", OcProperties.powerLimit.Default); + PRINT_LOGS("\nPower Limit Min: %lf", OcProperties.powerLimit.min); + PRINT_LOGS("\nPower Limit Max: %lf", OcProperties.powerLimit.max); + PRINT_LOGS("\nPower Limit Reference: %lf", OcProperties.powerLimit.reference); + PRINT_LOGS("\nPower Limit Step: %lf", OcProperties.powerLimit.step); + PRINT_LOGS("\nPower Limit Units: %s\n", printUnits(OcProperties.powerLimit.units).c_str()); // Slider for Temperature Limit - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); - PRINT_LOGS("\nTemperature Limit Default: %f", OcProperties.temperatureLimit.Default); - PRINT_LOGS("\nTemperature Limit Min: %f", OcProperties.temperatureLimit.min); - PRINT_LOGS("\nTemperature Limit Max: %f", OcProperties.temperatureLimit.max); - PRINT_LOGS("\nTemperature Limit Reference: %f", OcProperties.temperatureLimit.reference); - PRINT_LOGS("\nTemperature Limit Step: %f", OcProperties.temperatureLimit.step); - PRINT_LOGS("\nTemperature Limit Units: %s\n \n", printUnits(OcProperties.temperatureLimit.units)); + PRINT_LOGS("\nTemperature Limit Supported? %s ", OcProperties.temperatureLimit.bSupported ? "true" : "false"); + PRINT_LOGS("\nTemperature Limit Is Relative? %s", OcProperties.temperatureLimit.bRelative ? "true" : "false"); + PRINT_LOGS("\nTemperature Limit Have Reference? %s", OcProperties.temperatureLimit.bReference ? "true" : "false"); + PRINT_LOGS("\nTemperature Limit Default: %lf", OcProperties.temperatureLimit.Default); + PRINT_LOGS("\nTemperature Limit Min: %lf", OcProperties.temperatureLimit.min); + PRINT_LOGS("\nTemperature Limit Max: %lf", OcProperties.temperatureLimit.max); + PRINT_LOGS("\nTemperature Limit Reference: %lf", OcProperties.temperatureLimit.reference); + PRINT_LOGS("\nTemperature Limit Step: %lf", OcProperties.temperatureLimit.step); + PRINT_LOGS("\nTemperature Limit Units: %s\n", printUnits(OcProperties.temperatureLimit.units).c_str()); + + // Voltage Frequency Curve Property + PRINT_LOGS("\nVF Curve R/W Supported? %s ", OcProperties.gpuVFCurveVoltageLimit.bSupported ? "true" : "false"); + PRINT_LOGS("\nVF Curve Voltage Axis Min: %lf", OcProperties.gpuVFCurveVoltageLimit.min); + PRINT_LOGS("\nVF Curve Voltage Axis Max: %lf", OcProperties.gpuVFCurveVoltageLimit.max); + PRINT_LOGS("\nVF Curve Voltage Axis Step: %lf", OcProperties.gpuVFCurveVoltageLimit.step); + PRINT_LOGS("\nVF Curve Voltage Axis Units: %s\n", printUnits(OcProperties.gpuVFCurveVoltageLimit.units).c_str()); + + PRINT_LOGS("\nVF Curve R/W Supported? %s ", OcProperties.gpuVFCurveFrequencyLimit.bSupported ? "true" : "false"); + PRINT_LOGS("\nVF Curve Freq Axis Min: %lf", OcProperties.gpuVFCurveFrequencyLimit.min); + PRINT_LOGS("\nVF Curve Freq Axis Max: %lf", OcProperties.gpuVFCurveFrequencyLimit.max); + PRINT_LOGS("\nVF Curve Freq Axis Step: %lf", OcProperties.gpuVFCurveFrequencyLimit.step); + PRINT_LOGS("\nVF Curve Freq Axis Units: %s", printUnits(OcProperties.gpuVFCurveFrequencyLimit.units).c_str()); } /*************************************************************** - * @brief - * Overclock Frequency Offset: The function ctlOverclockGpuFrequencyOffsetSet + * @brief OverclockFrequencyOffset + * + * Overclock Frequency Offset: The function ctlOverclockGpuFrequencyOffsetSetV2 * allows to set a positive frequency offset. * @param * @return ***************************************************************/ void OverclockFrequencyOffset(ctl_device_adapter_handle_t hDAhandle) { - double GPUFrequencyOffset = 0.0; - - ctl_result_t Status = ctlOverclockGpuFrequencyOffsetGet(hDAhandle, &GPUFrequencyOffset); + ctl_oc_properties_t OcProperties = {}; + OcProperties.Size = sizeof(ctl_oc_properties_t); + OcProperties.Version = 1; + // Step 1: Reading Overclock Properties + ctl_result_t Status = ctlOverclockGetProperties(hDAhandle, &OcProperties); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockFrequencyOffset => ctlOverclockGetProperties Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } - PRINT_LOGS("\nCurrent Frequency Offset: %f MHz", GPUFrequencyOffset); - - // Setting 50 MHz Offset - GPUFrequencyOffset = 50.0; - - // Calling the waiver first - Status = ctlOverclockWaiverSet(hDAhandle); - + // Step 2: Reading Current Frequency Offset + // Output Frequency Offset units are returned in ctl_oc_properties_t::gpuFrequencyOffset::units returned from ctlOverclockGetProperties() + double GPUFrequencyOffset = 0.0; + Status = ctlOverclockGpuFrequencyOffsetGetV2(hDAhandle, &GPUFrequencyOffset); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockFrequencyOffset => ctlOverclockGpuFrequencyOffsetGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\n\nCurrent Frequency Offset: %lf, %s", GPUFrequencyOffset, printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); - // Setting the Offset - Status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); + // Step 3: Writing New Frequency Offset by increasing it by (Step * 5.0) MHz from min value + // Input Frequency Offset units are given in ctl_oc_properties_t::gpuFrequencyOffset::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::gpuFrequencyOffset::units for both Alchemist and Battlemage are CTL_UNITS_FREQUENCY_MHZ units + GPUFrequencyOffset = OcProperties.gpuFrequencyOffset.min + (OcProperties.gpuFrequencyOffset.step * 5.0); + Status = ctlOverclockGpuFrequencyOffsetSetV2(hDAhandle, GPUFrequencyOffset); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockFrequencyOffset => ctlOverclockGpuFrequencyOffsetSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nSetting New Frequency Offset: %lf, %s", GPUFrequencyOffset, printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); - // Reseting local var + // Step 4: Reading back New Frequency Offset + // Output Frequency Offset units are returned in ctl_oc_properties_t::gpuFrequencyOffset::units returned from ctlOverclockGetProperties() GPUFrequencyOffset = 0.0; - - // Read back to confirm the new value - Status = ctlOverclockGpuFrequencyOffsetGet(hDAhandle, &GPUFrequencyOffset); - + Status = ctlOverclockGpuFrequencyOffsetGetV2(hDAhandle, &GPUFrequencyOffset); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockFrequencyOffset => ctlOverclockGpuFrequencyOffsetGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nReading New Frequency Offset: %lf, %s", GPUFrequencyOffset, printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); - PRINT_LOGS("\nCurrent New Frequency Offset: %f MHz\n \n", GPUFrequencyOffset); - - // Setting the Offset to 0 - GPUFrequencyOffset = 0.0; - Status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); + // Step 5: Resetting Frequency Offset + // Input Frequency Offset units are given in ctl_oc_properties_t::gpuFrequencyOffset::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::gpuFrequencyOffset::units for both Alchemist and Battlemage are CTL_UNITS_FREQUENCY_MHZ units + GPUFrequencyOffset = OcProperties.gpuFrequencyOffset.Default; + Status = ctlOverclockGpuFrequencyOffsetSetV2(hDAhandle, GPUFrequencyOffset); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockFrequencyOffset => ctlOverclockGpuFrequencyOffsetSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } - -Exit: - return; + PRINT_LOGS("\nResetting Frequency Offset to Default Value: %lf, %s", GPUFrequencyOffset, printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); } /*************************************************************** - * @brief - * Overclock Voltage Offset: The function ctlOverclockGpuVoltageOffsetSet + * @brief OverclockVoltageOffset + * + * Overclock Voltage Offset: The function ctlOverclockGpuMaxVoltageOffsetSetV2 * allows to set a positive voltage offset. * @param * @return ***************************************************************/ void OverclockVoltageOffset(ctl_device_adapter_handle_t hDAhandle) { - double VoltageOffset = 0.0; - ctl_result_t Status = ctlOverclockGpuVoltageOffsetGet(hDAhandle, &VoltageOffset); + ctl_oc_properties_t OcProperties = {}; + OcProperties.Size = sizeof(ctl_oc_properties_t); + OcProperties.Version = 1; + // Step 1: Reading Overclock Properties + ctl_result_t Status = ctlOverclockGetProperties(hDAhandle, &OcProperties); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockGetProperties Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } - PRINT_LOGS("\n Current Voltage Offset: %f V", VoltageOffset); - - // Setting 25 mV Voltage Offset - VoltageOffset = 25; + // Step 2: Reading Current Voltage Offset + // Output Voltage Offset units are returned in ctl_oc_properties_t::gpuVoltageOffset::units returned from ctlOverclockGetProperties() + double VoltageOffset = 0.0; + Status = ctlOverclockGpuMaxVoltageOffsetGetV2(hDAhandle, &VoltageOffset); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockGpuMaxVoltageOffsetGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } + PRINT_LOGS("\n\nCurrent Voltage Offset: %lf, %s", VoltageOffset, printUnits(OcProperties.gpuVoltageOffset.units).c_str()); - // Calling the waiver first + // Step 3: Calling Waiver Set first before writing the Voltage Offset Status = ctlOverclockWaiverSet(hDAhandle); - if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockWaiverSet Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nOverclock Waiver Set Succesfully for ctlOverclockGpuMaxVoltageOffsetSetV2 API !!"); - // Setting the Offset - Status = ctlOverclockGpuVoltageOffsetSet(hDAhandle, VoltageOffset); - + // Step 4: Writing New Voltage Offset by increasing it by (Step * 5.0) from min value + // Input Voltage Offset units are given in ctl_oc_properties_t::gpuVoltageOffset::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::gpuVoltageOffset::units for Alchemist are CTL_UNITS_VOLTAGE_VOLTS units, for Battlemage are CTL_UNITS_PERCENT units + VoltageOffset = OcProperties.gpuVoltageOffset.min + (OcProperties.gpuVoltageOffset.step * 5.0); + Status = ctlOverclockGpuMaxVoltageOffsetSetV2(hDAhandle, VoltageOffset); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockGpuMaxVoltageOffsetSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nSetting New Voltage Offset: %lf, %s", VoltageOffset, printUnits(OcProperties.gpuVoltageOffset.units).c_str()); - // Reseting local var + // Step 5: Reading back New Voltage Offset + // Output Voltage Offset units are returned in ctl_oc_properties_t::gpuVoltageOffset::units returned from ctlOverclockGetProperties() VoltageOffset = 0.0; - - // Read back to confirm the new value - Status = ctlOverclockGpuVoltageOffsetGet(hDAhandle, &VoltageOffset); - + Status = ctlOverclockGpuMaxVoltageOffsetGetV2(hDAhandle, &VoltageOffset); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockGpuMaxVoltageOffsetGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nReading New Voltage Offset: %lf %s", VoltageOffset, printUnits(OcProperties.gpuVoltageOffset.units).c_str()); - PRINT_LOGS("\nCurrent New Voltage Offset: %f\n \n", VoltageOffset); - - // Setting the Offset to 0 - VoltageOffset = 0.0; - Status = ctlOverclockGpuVoltageOffsetSet(hDAhandle, VoltageOffset); + // Step 6: Resetting Voltage Offset + // Input Voltage Offset units are given in ctl_oc_properties_t::gpuVoltageOffset::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::gpuVoltageOffset::units for Alchemist are CTL_UNITS_VOLTAGE_VOLTS units, for Battlemage are CTL_UNITS_PERCENT units + VoltageOffset = OcProperties.gpuVoltageOffset.Default; + Status = ctlOverclockGpuMaxVoltageOffsetSetV2(hDAhandle, VoltageOffset); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockGpuMaxVoltageOffsetSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } - -Exit: - return; + PRINT_LOGS("\nResetting Voltage Offset to Default Value: %lf, %s", VoltageOffset, printUnits(OcProperties.gpuVoltageOffset.units).c_str()); } /*************************************************************** - * @brief + * @brief OverclockLockFrequency * Overclock Lock Frequency: The function ctlOverclockGpuLockSet * allows to fix the frequency and voltage, useful for OC scanners * or performance testing. @@ -445,142 +405,145 @@ void OverclockLockFrequency(ctl_device_adapter_handle_t hDAhandle) { ctl_oc_properties_t OcProperties = {}; OcProperties.Size = sizeof(ctl_oc_properties_t); - ctl_oc_vf_pair_t VfPair = {}; + OcProperties.Version = 1; + // Step 1: Reading Overclock Properties ctl_result_t Status = ctlOverclockGetProperties(hDAhandle, &OcProperties); - if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockLockFrequency => ctlOverclockGetProperties Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } - Status = ctlOverclockGpuLockGet(hDAhandle, &VfPair); - + // ctlOverclockGpuLockGet, ctlOverclockGpuLockSet APIs are only supported for Alchemist, not supported for Battlemage + // Step 2: Reading Current Locked OC VF Pair + ctl_oc_vf_pair_t VfPair = {}; + Status = ctlOverclockGpuLockGet(hDAhandle, &VfPair); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockLockFrequency => ctlOverclockGpuLockGet Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nCurrent Locked OC VF Pair - Locked Frequency: %lf MHz, Locked Voltage: %lf mV", VfPair.Frequency, VfPair.Voltage); - PRINT_LOGS("\nCurrent Locked Frequency: %f MHz", VfPair.Frequency); - PRINT_LOGS("\nCurrent Locked Voltage: %f mV", VfPair.Voltage); + // Step 3: Calling Waiver Set first before writing the Locked OC VF Pair + Status = ctlOverclockWaiverSet(hDAhandle); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockLockFrequency => ctlOverclockWaiverSet Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } - VfPair = {}; + // Step 3: Setting New Locked OC VF Pair // Set slighly more frequency and voltage // 50 MHz over reference frequency + VfPair = {}; VfPair.Frequency = OcProperties.gpuFrequencyOffset.reference + 50.0; // 50 mV over reference voltage. Convert to mV first. VfPair.Voltage = OcProperties.gpuVoltageOffset.reference * 1000.0 + 50.0; - - Status = ctlOverclockGpuLockSet(hDAhandle, VfPair); - + Status = ctlOverclockGpuLockSet(hDAhandle, VfPair); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockLockFrequency => ctlOverclockGpuLockSet Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nSetting New Locked OC VF Pair - Locked Frequency: %lf MHz, Locked Voltage: %lf mV", VfPair.Frequency, VfPair.Voltage); - // Reseting local var + // Step 4: Reading back New Locked OC VF Pair VfPair = {}; Status = ctlOverclockGpuLockGet(hDAhandle, &VfPair); - if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); - goto Exit; + PRINT_LOGS("\nOverclockLockFrequency => ctlOverclockGpuLockGet Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nReading New Locked OC VF Pair - Locked Frequency: %lf MHz, Locked Voltage: %lf mV", VfPair.Frequency, VfPair.Voltage); - // Verifying the new locked frequency and voltage - PRINT_LOGS("\nNew Current Locked Frequency: %f MHz", VfPair.Frequency); - PRINT_LOGS("\nNew Current Locked Voltage: %f mV \n \n", VfPair.Voltage); - - // Reset to default + // Step 5: Resetting Locked OC VF Pair VfPair = {}; - ctlOverclockGpuLockSet(hDAhandle, VfPair); - -Exit: - return; + Status = ctlOverclockGpuLockSet(hDAhandle, VfPair); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockLockFrequency => ctlOverclockGpuLockSet Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } + PRINT_LOGS("\nResetting Locked OC VF Pair - Locked Frequency: %lf MHz, Locked Voltage: %lf mV", VfPair.Frequency, VfPair.Voltage); } -/*************************************************************** - * @brief Main Function +/***************************************************************** + * @brief OverclockPowerLimit * - * Overclock Power Limit: The function ctlOverclockPowerLimitSet - * allows to increase or decrease the power (TPD) budget for the + * Overclock Power Limit: The function ctlOverclockPowerLimitSetV2 + * allows to increase or decrease the power (TDP) budget for the * adapter. * @param * @return - ***************************************************************/ + *****************************************************************/ void OverclockPowerLimit(ctl_device_adapter_handle_t hDAhandle) { ctl_oc_properties_t OcProperties = {}; OcProperties.Size = sizeof(ctl_oc_properties_t); + OcProperties.Version = 1; + // Step 1: Reading Overclock Properties ctl_result_t Status = ctlOverclockGetProperties(hDAhandle, &OcProperties); - if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockPowerLimit => ctlOverclockGetProperties Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nGetting current Power Limit\n \n"); - + // Step 2: Reading Current Sustained Power Limit + // Output Sustained Power Limit units are returned in ctl_oc_properties_t::powerLimit::units returned from ctlOverclockGetProperties() double CurrentPowerLimit = 0.0; - - Status = ctlOverclockPowerLimitGet(hDAhandle, &CurrentPowerLimit); - - if (Status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nCurrent Sustained Power Limit: %f", CurrentPowerLimit); - } - else + Status = ctlOverclockPowerLimitGetV2(hDAhandle, &CurrentPowerLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockPowerLimit => ctlOverclockPowerLimitGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\n\nCurrent Sustained Power Limit: %lf, %s", CurrentPowerLimit, printUnits(OcProperties.powerLimit.units).c_str()); - PRINT_LOGS("\nSetting current Power Limit inside limits: \n \n"); - - // Convert to mW and get min + 15 W. - CurrentPowerLimit = OcProperties.powerLimit.Default * 1000.0 + 15000.0; - - Status = ctlOverclockPowerLimitSet(hDAhandle, CurrentPowerLimit); - - if (Status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nPower Limit set correctly.\n \n"); - } - else + // Step 3: Writing New Sustained Power Limit by increasing it by (Step * 5.0) from min value + // Input Sustained Power Limit units are given in ctl_oc_properties_t::powerLimit::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::powerLimit::units for Alchemist are CTL_UNITS_POWER_WATTS units, for Battlemage are CTL_UNITS_PERCENT units + CurrentPowerLimit = OcProperties.powerLimit.min + (OcProperties.powerLimit.step * 5.0); + Status = ctlOverclockPowerLimitSetV2(hDAhandle, CurrentPowerLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockPowerLimit => ctlOverclockPowerLimitSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nSetting New Sustained Power Limit: %lf, %s", CurrentPowerLimit, printUnits(OcProperties.powerLimit.units).c_str()); - PRINT_LOGS("\nGetting the now current Power Limit:\n \n"); - - double NewCurrentPowerLimit = 0.0; - - Status = ctlOverclockPowerLimitGet(hDAhandle, &NewCurrentPowerLimit); - - if (Status == ctl_result_t::CTL_RESULT_SUCCESS) + // Step 4: Reading back New Sustained Power Limit + // Output Sustained Power Limit units are returned in ctl_oc_properties_t::powerLimit::units returned from ctlOverclockGetProperties() + CurrentPowerLimit = 0.0; + Status = ctlOverclockPowerLimitGetV2(hDAhandle, &CurrentPowerLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nCurrent Sustained Power Limit: %f", NewCurrentPowerLimit); - PRINT_LOGS("\nRequested Sustained Power Limit: %f", CurrentPowerLimit); + PRINT_LOGS("\nOverclockPowerLimit => ctlOverclockPowerLimitGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } - else + PRINT_LOGS("\nReading New Sustained Power Limit: %lf, %s", CurrentPowerLimit, printUnits(OcProperties.powerLimit.units).c_str()); + + // Step 5: Resetting Sustained Power Limit + // Input Sustained Power Limit units are given in ctl_oc_properties_t::powerLimit::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::powerLimit::units for Alchemist are CTL_UNITS_POWER_WATTS units, for Battlemage are CTL_UNITS_PERCENT units + CurrentPowerLimit = OcProperties.powerLimit.Default; + Status = ctlOverclockPowerLimitSetV2(hDAhandle, CurrentPowerLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n \n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockPowerLimit => ctlOverclockPowerLimitSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } - - // Reset to default - CurrentPowerLimit = OcProperties.powerLimit.Default * 1000.0; - ctlOverclockPowerLimitSet(hDAhandle, CurrentPowerLimit); + PRINT_LOGS("\nResetting Sustained Power Limit to Default Value: %lf %s", CurrentPowerLimit, printUnits(OcProperties.powerLimit.units).c_str()); } /*************************************************************** - * @brief Main Function + * @brief OverclockTemperatureLimit * - * Overclock Temperature Limit: The function ctlOverclockTemperatureLimitSet + * Overclock Temperature Limit: The function ctlOverclockTemperatureLimitSetV2 * allows to increase or decrease the temperature limit. If the temperature reaches * the limit, frequency will be throttled to be within the temperature limit. * adapter. @@ -591,68 +554,316 @@ void OverclockTemperatureLimit(ctl_device_adapter_handle_t hDAhandle) { ctl_oc_properties_t OcProperties = {}; OcProperties.Size = sizeof(ctl_oc_properties_t); - ctl_result_t Result = CTL_RESULT_SUCCESS; + OcProperties.Version = 1; + // Step 1: Reading Overclock Properties ctl_result_t Status = ctlOverclockGetProperties(hDAhandle, &OcProperties); - if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockTemperatureLimit => ctlOverclockGetProperties Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nGetting current Temperature Limit\n"); + // Step 2: Reading Current Temperature Limit + // Output Temperature Limit units are returned in ctl_oc_properties_t::temperatureLimit::units returned from ctlOverclockGetProperties() double CurrentTemperatureLimit = 0.0; + Status = ctlOverclockTemperatureLimitGetV2(hDAhandle, &CurrentTemperatureLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockTemperatureLimit => ctlOverclockTemperatureLimitGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } + PRINT_LOGS("\n\nCurrent Temperature Limit: %lf, %s", CurrentTemperatureLimit, printUnits(OcProperties.temperatureLimit.units).c_str()); - Status = ctlOverclockTemperatureLimitGet(hDAhandle, &CurrentTemperatureLimit); + // Step 3: Writing New Temperature Limit by increasing it by (Step * 5.0) from min value + // Input Temperature Limit units are given in ctl_oc_properties_t::temperatureLimit::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::temperatureLimit::units for Alchemist are CTL_UNITS_TEMPERATURE_CELSIUS units, for Battlemage are CTL_UNITS_PERCENT units + CurrentTemperatureLimit = OcProperties.temperatureLimit.min + (OcProperties.temperatureLimit.step * 5.0); + Status = ctlOverclockTemperatureLimitSetV2(hDAhandle, CurrentTemperatureLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockTemperatureLimit => ctlOverclockTemperatureLimitSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } + PRINT_LOGS("\nSetting New Temperature Limit: %lf, %s", CurrentTemperatureLimit, printUnits(OcProperties.temperatureLimit.units).c_str()); - if (Status == ctl_result_t::CTL_RESULT_SUCCESS) + // Step 4: Reading back New Temperature Limit + // Output Temperature Limit units are returned in ctl_oc_properties_t::temperatureLimit::units returned from ctlOverclockGetProperties() + CurrentTemperatureLimit = 0.0; + Status = ctlOverclockTemperatureLimitGetV2(hDAhandle, &CurrentTemperatureLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nCurrent Temperature Limit: %f\n", CurrentTemperatureLimit); + PRINT_LOGS("\nOverclockTemperatureLimit => ctlOverclockTemperatureLimitGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } - else + PRINT_LOGS("\nReading New Temperature Limit: %lf, %s", CurrentTemperatureLimit, printUnits(OcProperties.temperatureLimit.units).c_str()); + + // Step 5: Resetting Temperature Limit + // Input Temperature Limit units are given in ctl_oc_properties_t::temperatureLimit::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::temperatureLimit::units for Alchemist are CTL_UNITS_TEMPERATURE_CELSIUS units, for Battlemage are CTL_UNITS_PERCENT units + CurrentTemperatureLimit = OcProperties.temperatureLimit.Default; + Status = ctlOverclockTemperatureLimitSetV2(hDAhandle, CurrentTemperatureLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockTemperatureLimit => ctlOverclockTemperatureLimitSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nResetting Temperature Limit to Default Value: %lf, %s", CurrentTemperatureLimit, printUnits(OcProperties.temperatureLimit.units).c_str()); +} - PRINT_LOGS("\nSetting current Temperature Limit \n \n"); +/*************************************************************** + * @brief OverclockVramMemSpeedLimit + * VramMemSpeedLimit Overclocking V2 APIs are only supported for Battlemage, not supported for Alchemist + * adapter. + * @param + * @return + ***************************************************************/ +void OverclockVramMemSpeedLimit(ctl_device_adapter_handle_t hDAhandle) +{ + ctl_oc_properties_t OcProperties = {}; + OcProperties.Size = sizeof(ctl_oc_properties_t); + OcProperties.Version = 1; - CurrentTemperatureLimit = OcProperties.temperatureLimit.Default + 5.0; + // Step 1: Reading Overclock Properties + ctl_result_t Status = ctlOverclockGetProperties(hDAhandle, &OcProperties); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVramMemSpeedLimit => ctlOverclockGetProperties Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } - Status = ctlOverclockTemperatureLimitSet(hDAhandle, CurrentTemperatureLimit); + // Below set of VramMemSpeedLimit Overclocking V2 APIs are only supported for Battlemage, not supported for Alchemist + // + // Step 2: Reading Current VramMemSpeed Limit + // Output VramMemSpeed Limit units are returned in ctl_oc_properties_t::vramMemSpeedLimit::units returned from ctlOverclockGetProperties() + double CurrentVramMemSpeedLimit = 0.0; + Status = ctlOverclockVramMemSpeedLimitGetV2(hDAhandle, &CurrentVramMemSpeedLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVramMemSpeedLimit => ctlOverclockVramMemSpeedLimitGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } + PRINT_LOGS("\n\nCurrent VramMemSpeed Limit: %lf, %s", CurrentVramMemSpeedLimit, printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); - if (Status == ctl_result_t::CTL_RESULT_SUCCESS) + // Step 3: Writing New VramMemSpeed Limit by increasing it by (Step * 5.0) Gbps from min value + // Input VramMemSpeed Limit units are given in ctl_oc_properties_t::vramMemSpeedLimit::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::vramMemSpeedLimit::units for Battlemage are CTL_UNITS_MEM_SPEED_GBPS units + CurrentVramMemSpeedLimit = OcProperties.vramMemSpeedLimit.min + (OcProperties.vramMemSpeedLimit.step * 5.0); + Status = ctlOverclockVramMemSpeedLimitSetV2(hDAhandle, CurrentVramMemSpeedLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nTemperature Limit set correctly.\n"); + PRINT_LOGS("\nOverclockVramMemSpeedLimit => ctlOverclockVramMemSpeedLimitSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } - else + PRINT_LOGS("\nSetting New VramMemSpeed Limit: %lf, %s", CurrentVramMemSpeedLimit, printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); + + // Step 4: Reading back New VramMemSpeed Limit + // Output VramMemSpeed Limit units are returned in ctl_oc_properties_t::vramMemSpeedLimit::units returned from ctlOverclockGetProperties() + CurrentVramMemSpeedLimit = 0.0; + Status = ctlOverclockVramMemSpeedLimitGetV2(hDAhandle, &CurrentVramMemSpeedLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s\n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockVramMemSpeedLimit => ctlOverclockVramMemSpeedLimitGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; } + PRINT_LOGS("\nReading New VramMemSpeed Limit: %lf, %s", CurrentVramMemSpeedLimit, printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); - PRINT_LOGS("\nGetting the now current Temperature Limit:\n \n"); + // Step 5: Resetting VramMemSpeed Limit + // Input VramMemSpeed Limit units are given in ctl_oc_properties_t::vramMemSpeedLimit::units returned from ctlOverclockGetProperties() + // Currently ctl_oc_properties_t::vramMemSpeedLimit::units for Battlemage are CTL_UNITS_MEM_SPEED_GBPS units + CurrentVramMemSpeedLimit = OcProperties.vramMemSpeedLimit.Default; + Status = ctlOverclockVramMemSpeedLimitSetV2(hDAhandle, CurrentVramMemSpeedLimit); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVramMemSpeedLimit => ctlOverclockVramMemSpeedLimitSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } + PRINT_LOGS("\nResetting VramMemSpeed Limit to Default Value: %lf, %s", CurrentVramMemSpeedLimit, printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); +} - double NewCurrentTemperatureLimit = 0.0; +/*************************************************************** + * @brief OverclockVFCurveReadWrite + * VFCurve Read/Write Overclocking V2 APIs are only supported for Battlemage, not supported for Alchemist + * adapter. + * @param + * @return + ***************************************************************/ +void OverclockVFCurveReadWrite(ctl_device_adapter_handle_t hDAhandle) +{ + ctl_vf_curve_type_t VFCurveType = CTL_VF_CURVE_TYPE_STOCK; + ctl_vf_curve_details_t VFCurveDetails = CTL_VF_CURVE_DETAILS_SIMPLIFIED; + uint32_t NumVFPoints = 0; + ctl_voltage_frequency_point_t *pVFCurveTable = NULL; + ctl_result_t Status = CTL_RESULT_SUCCESS; + + // Below set of VFCurve Read/Write Overclocking V2 APIs are only supported for Battlemage, not supported for Alchemist + + PRINT_LOGS("\n\n======================== OverclockVFCurveReadWrite ==============================="); + PRINT_LOGS("\n================================== STEP 1 ========================================"); + // Step 1: Read Stock VF Curve Points with VFCurveDetails as Simplified, Medium, Elaborate + VFCurveType = CTL_VF_CURVE_TYPE_STOCK; + for (uint32_t VFCurveDetailsIndex = CTL_VF_CURVE_DETAILS_SIMPLIFIED; VFCurveDetailsIndex < CTL_VF_CURVE_DETAILS_MAX; VFCurveDetailsIndex++) + { + NumVFPoints = 0; + VFCurveDetails = (ctl_vf_curve_details_t)VFCurveDetailsIndex; + Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, nullptr); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + DecodeRetCode(Status).c_str(), Status); + return; + } + else + { + PRINT_LOGS("\n\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, NumVFPoints: %lu", printVFCurveDetails(VFCurveDetails).c_str(), NumVFPoints); + pVFCurveTable = (ctl_voltage_frequency_point_t *)malloc(sizeof(ctl_voltage_frequency_point_t) * NumVFPoints); - Status = ctlOverclockTemperatureLimitGet(hDAhandle, &NewCurrentTemperatureLimit); + if (pVFCurveTable == NULL) + { + free(pVFCurveTable); + goto Exit; + } - if (Status == ctl_result_t::CTL_RESULT_SUCCESS) + Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, pVFCurveTable); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + DecodeRetCode(Status).c_str(), Status); + free(pVFCurveTable); + goto Exit; + } + for (uint32_t i = 0; i < NumVFPoints; i++) + { + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), i, + pVFCurveTable[i].Frequency, pVFCurveTable[i].Voltage); + } + free(pVFCurveTable); + } + } + + PRINT_LOGS("\n================================== STEP 2 ========================================"); + // Step 2.1: Calling Waiver Set first before calling ctlOverclockWriteCustomVFCurve + Status = ctlOverclockWaiverSet(hDAhandle); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVFCurveReadWrite => ctlOverclockWaiverSet Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } + PRINT_LOGS("\nOverclock Waiver Set Succesfully for ctlOverclockWriteCustomVFCurve API !!"); + + // Step 2.2: Modify few points in Stock Simplified VFCurveTable and perform VFCurveWrite + NumVFPoints = 0; + VFCurveType = CTL_VF_CURVE_TYPE_STOCK; + VFCurveDetails = CTL_VF_CURVE_DETAILS_SIMPLIFIED; + Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, nullptr); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nCurrent Temperature Limit: %f", NewCurrentTemperatureLimit); - PRINT_LOGS("\nRequested Temperature Limit: %f", CurrentTemperatureLimit); + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + DecodeRetCode(Status).c_str(), Status); + return; } else { - PRINT_LOGS("\nResult: Error %s\n \n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, NumVFPoints: %lu", printVFCurveDetails(VFCurveDetails).c_str(), NumVFPoints); + pVFCurveTable = (ctl_voltage_frequency_point_t *)malloc(sizeof(ctl_voltage_frequency_point_t) * NumVFPoints); + + if (pVFCurveTable == NULL) + { + free(pVFCurveTable); + goto Exit; + } + + Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, pVFCurveTable); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + DecodeRetCode(Status).c_str(), Status); + free(pVFCurveTable); + goto Exit; + } + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, Before modifying VFPoint 5, VFPoint 6", printVFCurveDetails(VFCurveDetails).c_str()); + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), 5, + pVFCurveTable[5].Frequency, pVFCurveTable[5].Voltage); + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), 6, + pVFCurveTable[6].Frequency, pVFCurveTable[6].Voltage); + + pVFCurveTable[5].Frequency += 50; + pVFCurveTable[6].Frequency += 100; + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, After modifying VFPoint 5, VFPoint 6", printVFCurveDetails(VFCurveDetails).c_str()); + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), 5, + pVFCurveTable[5].Frequency, pVFCurveTable[5].Voltage); + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), 6, + pVFCurveTable[6].Frequency, pVFCurveTable[6].Voltage); + + Status = ctlOverclockWriteCustomVFCurve(hDAhandle, NumVFPoints, pVFCurveTable); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockWriteCustomVFCurve, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + DecodeRetCode(Status).c_str(), Status); + free(pVFCurveTable); + goto Exit; + } + free(pVFCurveTable); } - // Resetting to default - CurrentTemperatureLimit = OcProperties.temperatureLimit.Default; - ctlOverclockTemperatureLimitSet(hDAhandle, CurrentTemperatureLimit); + PRINT_LOGS("\n================================== STEP 3 ========================================"); + // Step 3: Read Live VF Curve Points with VFCurveDetails as Simplified, Medium, Elaborate + VFCurveType = CTL_VF_CURVE_TYPE_LIVE; + for (uint32_t VFCurveDetailsIndex = CTL_VF_CURVE_DETAILS_SIMPLIFIED; VFCurveDetailsIndex < CTL_VF_CURVE_DETAILS_MAX; VFCurveDetailsIndex++) + { + NumVFPoints = 0; + VFCurveDetails = (ctl_vf_curve_details_t)VFCurveDetailsIndex; + Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, nullptr); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 1, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + DecodeRetCode(Status).c_str(), Status); + return; + } + else + { + PRINT_LOGS("\n\nCTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 1, NumVFPoints: %lu", printVFCurveDetails(VFCurveDetails).c_str(), NumVFPoints); + pVFCurveTable = (ctl_voltage_frequency_point_t *)malloc(sizeof(ctl_voltage_frequency_point_t) * NumVFPoints); + + if (pVFCurveTable == NULL) + { + free(pVFCurveTable); + goto Exit; + } + + Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, pVFCurveTable); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 2, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + DecodeRetCode(Status).c_str(), Status); + free(pVFCurveTable); + goto Exit; + } + for (uint32_t i = 0; i < NumVFPoints; i++) + { + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), i, + pVFCurveTable[i].Frequency, pVFCurveTable[i].Voltage); + } + free(pVFCurveTable); + } + } + +Exit: + pVFCurveTable = nullptr; + + PRINT_LOGS("\n================================== STEP 4 ========================================"); + // Step 4: Reset all OC controls (FrequencyOffset, VoltageOffset, PowerLimit, TemperatureLimit, VramMemSpeedLimit including VFCurve) + Status = ctlOverclockResetToDefault(hDAhandle); + if (Status != ctl_result_t::CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nOverclockVFCurveReadWrite => ctlOverclockResetToDefault, Error: %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); + return; + } + PRINT_LOGS("\nctlOverclockResetToDefault to reset all OC controls (FrequencyOffset, VoltageOffset, PowerLimit, TemperatureLimit, VramMemSpeedLimit including VFCurve) is successful !\n"); } /*************************************************************** - * @brief Main Function + * @brief OverclockPowerTelemetry * * Overclock Power Temeletry: The function ctlPowerTelemetryGet allows * to retrieve all the available metrics from the adapter in one @@ -664,6 +875,7 @@ void OverclockPowerTelemetry(ctl_device_adapter_handle_t hDAhandle) { ctl_power_telemetry_t pPowerTelemetry = {}; pPowerTelemetry.Size = sizeof(ctl_power_telemetry_t); + pPowerTelemetry.Version = 1; ctl_result_t Status = ctlPowerTelemetryGet(hDAhandle, &pPowerTelemetry); @@ -671,105 +883,174 @@ void OverclockPowerTelemetry(ctl_device_adapter_handle_t hDAhandle) { PRINT_LOGS("\nTelemetry Success\n \n"); - PRINT_LOGS("\nTimeStamp"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.timeStamp.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits %s", printUnits(pPowerTelemetry.timeStamp.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.timeStamp.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.timeStamp.value.datadouble); - - PRINT_LOGS("\nGpu Energy Counter:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.gpuEnergyCounter.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits:%s", printUnits(pPowerTelemetry.gpuEnergyCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.gpuEnergyCounter.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.gpuEnergyCounter.value.datadouble); - - PRINT_LOGS("\nGpu Voltage:"); - PRINT_LOGS("\n Supported : %s", ((pPowerTelemetry.gpuVoltage.bSupported) ? " true " : " false ")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.gpuVoltage.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.gpuVoltage.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.gpuVoltage.value.datadouble); - - PRINT_LOGS("\nGpu Current Frequency:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.gpuCurrentClockFrequency.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.gpuCurrentClockFrequency.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.gpuCurrentClockFrequency.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.gpuCurrentClockFrequency.value.datadouble); - - PRINT_LOGS("\nGpu Current Temperature:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.gpuCurrentTemperature.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.gpuCurrentTemperature.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.gpuCurrentTemperature.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.gpuCurrentTemperature.value.datadouble); - - PRINT_LOGS("\nGpu Activity Counter:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.globalActivityCounter.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.globalActivityCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.globalActivityCounter.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.globalActivityCounter.value.datadouble); - - PRINT_LOGS("\nRender Activity Counter:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.renderComputeActivityCounter.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.renderComputeActivityCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.renderComputeActivityCounter.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.renderComputeActivityCounter.value.datadouble); - - PRINT_LOGS("\nMedia Activity Counter:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.mediaActivityCounter.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.mediaActivityCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.mediaActivityCounter.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.mediaActivityCounter.value.datadouble); - - PRINT_LOGS("\nVRAM Energy Counter:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramEnergyCounter.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramEnergyCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramEnergyCounter.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.vramEnergyCounter.value.datadouble); - - PRINT_LOGS("\nVRAM Voltage:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramVoltage.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramVoltage.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramVoltage.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.vramVoltage.value.datadouble); - - PRINT_LOGS("\nVRAM Frequency:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramCurrentClockFrequency.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramCurrentClockFrequency.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentClockFrequency.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.vramCurrentClockFrequency.value.datadouble); - - PRINT_LOGS("\nVRAM Effective Frequency:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramCurrentEffectiveFrequency.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramCurrentEffectiveFrequency.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentEffectiveFrequency.type)); - PRINT_LOGS("\nValue: %f \n", pPowerTelemetry.vramCurrentEffectiveFrequency.value.datadouble); - - PRINT_LOGS("\nVRAM Read Bandwidth Counter:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramReadBandwidthCounter.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramReadBandwidthCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramReadBandwidthCounter.type)); - PRINT_LOGS("\nValue: %llu\n", pPowerTelemetry.vramReadBandwidthCounter.value.datau64); - - PRINT_LOGS("\nVRAM Write Bandwidth Counter:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramWriteBandwidthCounter.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramWriteBandwidthCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramWriteBandwidthCounter.type)); - PRINT_LOGS("\nValue: %llu\n", pPowerTelemetry.vramWriteBandwidthCounter.value.datau64); - - PRINT_LOGS("\nVRAM Temperature:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.vramCurrentTemperature.bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramCurrentTemperature.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentTemperature.type)); - PRINT_LOGS("\nValue: %f\n", pPowerTelemetry.vramCurrentTemperature.value.datadouble); - - PRINT_LOGS("\nFan Speed:"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", (pPowerTelemetry.fanSpeed[0].bSupported) ? "true" : "false"); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.fanSpeed[0].units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.fanSpeed[0].type)); - PRINT_LOGS("\nValue: %f \n \n", pPowerTelemetry.fanSpeed[0].value.datadouble); + if (pPowerTelemetry.timeStamp.bSupported) + { + PRINT_LOGS("\nTimeStamp: %f (%s) Datatype:(%s)", pPowerTelemetry.timeStamp.value.datadouble, printUnits(pPowerTelemetry.timeStamp.units).c_str(), + printType(pPowerTelemetry.timeStamp.type).c_str()); + } + + if (pPowerTelemetry.gpuEnergyCounter.bSupported) + { + PRINT_LOGS("\nGpu Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.gpuEnergyCounter.units).c_str(), + printType(pPowerTelemetry.gpuEnergyCounter.type).c_str()); + } + + if (pPowerTelemetry.vramEnergyCounter.bSupported) + { + PRINT_LOGS("\nVRAM Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.vramEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.vramEnergyCounter.units).c_str(), + printType(pPowerTelemetry.vramEnergyCounter.type).c_str()); + } + + if (pPowerTelemetry.totalCardEnergyCounter.bSupported) + { + PRINT_LOGS("\nCard Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.totalCardEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.totalCardEnergyCounter.units).c_str(), + printType(pPowerTelemetry.totalCardEnergyCounter.type).c_str()); + } + + if (pPowerTelemetry.gpuVoltage.bSupported) + { + PRINT_LOGS("\nGpu Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVoltage.value.datadouble, printUnits(pPowerTelemetry.gpuVoltage.units).c_str(), + printType(pPowerTelemetry.gpuVoltage.type).c_str()); + } + + if (pPowerTelemetry.gpuCurrentClockFrequency.bSupported) + { + PRINT_LOGS("\nGpu Current Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentClockFrequency.value.datadouble, printUnits(pPowerTelemetry.gpuCurrentClockFrequency.units).c_str(), + printType(pPowerTelemetry.gpuCurrentClockFrequency.type).c_str()); + } + + if (pPowerTelemetry.gpuCurrentTemperature.bSupported) + { + PRINT_LOGS("\nGpu Current Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentTemperature.value.datadouble, printUnits(pPowerTelemetry.gpuCurrentTemperature.units).c_str(), + printType(pPowerTelemetry.gpuCurrentTemperature.type).c_str()); + } + + if (pPowerTelemetry.globalActivityCounter.bSupported) + { + PRINT_LOGS("\nGpu Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.globalActivityCounter.value.datadouble, printUnits(pPowerTelemetry.globalActivityCounter.units).c_str(), + printType(pPowerTelemetry.globalActivityCounter.type).c_str()); + } + + if (pPowerTelemetry.renderComputeActivityCounter.bSupported) + { + PRINT_LOGS("\nRender Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.renderComputeActivityCounter.value.datadouble, + printUnits(pPowerTelemetry.renderComputeActivityCounter.units).c_str(), printType(pPowerTelemetry.renderComputeActivityCounter.type).c_str()); + } + + if (pPowerTelemetry.mediaActivityCounter.bSupported) + { + PRINT_LOGS("\nMedia Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.mediaActivityCounter.value.datadouble, printUnits(pPowerTelemetry.mediaActivityCounter.units).c_str(), + printType(pPowerTelemetry.mediaActivityCounter.type).c_str()); + } + + if (pPowerTelemetry.vramVoltage.bSupported) + { + PRINT_LOGS("\nVRAM Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVoltage.value.datadouble, printUnits(pPowerTelemetry.vramVoltage.units).c_str(), + printType(pPowerTelemetry.vramVoltage.type).c_str()); + } + + if (pPowerTelemetry.vramCurrentClockFrequency.bSupported) + { + PRINT_LOGS("\nVRAM Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentClockFrequency.value.datadouble, printUnits(pPowerTelemetry.vramCurrentClockFrequency.units).c_str(), + printType(pPowerTelemetry.vramCurrentClockFrequency.type).c_str()); + } + + if (pPowerTelemetry.vramReadBandwidthCounter.bSupported) + { + PRINT_LOGS("\nVRAM Read Bandwidth Counter: %llu (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidthCounter.value.datau64, + printUnits(pPowerTelemetry.vramReadBandwidthCounter.units).c_str(), printType(pPowerTelemetry.vramReadBandwidthCounter.type).c_str()); + } + + if (pPowerTelemetry.vramWriteBandwidthCounter.bSupported) + { + PRINT_LOGS("\nVRAM Write Bandwidth Counter: %llu (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidthCounter.value.datau64, + printUnits(pPowerTelemetry.vramWriteBandwidthCounter.units).c_str(), printType(pPowerTelemetry.vramWriteBandwidthCounter.type).c_str()); + } + + if (pPowerTelemetry.vramCurrentEffectiveFrequency.bSupported) + { + PRINT_LOGS("\nVRAM Effective Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentEffectiveFrequency.value.datadouble, + printUnits(pPowerTelemetry.vramCurrentEffectiveFrequency.units).c_str(), printType(pPowerTelemetry.vramCurrentEffectiveFrequency.type).c_str()); + } + + if (pPowerTelemetry.vramCurrentTemperature.bSupported) + { + PRINT_LOGS("\nVRAM Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentTemperature.value.datadouble, printUnits(pPowerTelemetry.vramCurrentTemperature.units).c_str(), + printType(pPowerTelemetry.vramCurrentTemperature.type).c_str()); + } + + if (pPowerTelemetry.vramReadBandwidth.bSupported) + { + PRINT_LOGS("\nVRAM Read Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidth.value.datadouble, printUnits(pPowerTelemetry.vramReadBandwidth.units).c_str(), + printType(pPowerTelemetry.vramReadBandwidth.type).c_str()); + } + + if (pPowerTelemetry.vramWriteBandwidth.bSupported) + { + PRINT_LOGS("\nVRAM Write Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidth.value.datadouble, printUnits(pPowerTelemetry.vramWriteBandwidth.units).c_str(), + printType(pPowerTelemetry.vramWriteBandwidth.type).c_str()); + } + + if (pPowerTelemetry.gpuVrTemp.bSupported) + { + PRINT_LOGS("\nGPU VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVrTemp.value.datadouble, printUnits(pPowerTelemetry.gpuVrTemp.units).c_str(), + printType(pPowerTelemetry.gpuVrTemp.type).c_str()); + } + + if (pPowerTelemetry.vramVrTemp.bSupported) + { + PRINT_LOGS("\nVRAM VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVrTemp.value.datadouble, printUnits(pPowerTelemetry.vramVrTemp.units).c_str(), + printType(pPowerTelemetry.vramVrTemp.type).c_str()); + } + + if (pPowerTelemetry.saVrTemp.bSupported) + { + PRINT_LOGS("\nSA VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.saVrTemp.value.datadouble, printUnits(pPowerTelemetry.saVrTemp.units).c_str(), + printType(pPowerTelemetry.saVrTemp.type).c_str()); + } + + if (pPowerTelemetry.gpuEffectiveClock.bSupported) + { + PRINT_LOGS("\nEffective frequency of the GPU: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEffectiveClock.value.datadouble, printUnits(pPowerTelemetry.gpuEffectiveClock.units).c_str(), + printType(pPowerTelemetry.gpuEffectiveClock.type).c_str()); + } + + if (pPowerTelemetry.gpuOverVoltagePercent.bSupported) + { + PRINT_LOGS("\nGPU Overvoltage Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuOverVoltagePercent.value.datadouble, printUnits(pPowerTelemetry.gpuOverVoltagePercent.units).c_str(), + printType(pPowerTelemetry.gpuOverVoltagePercent.type).c_str()); + } + + if (pPowerTelemetry.gpuPowerPercent.bSupported) + { + PRINT_LOGS("\nGPU Power Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuPowerPercent.value.datadouble, printUnits(pPowerTelemetry.gpuPowerPercent.units).c_str(), + printType(pPowerTelemetry.gpuPowerPercent.type).c_str()); + } + + if (pPowerTelemetry.gpuTemperaturePercent.bSupported) + { + PRINT_LOGS("\nGPU Temperature Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuTemperaturePercent.value.datadouble, printUnits(pPowerTelemetry.gpuTemperaturePercent.units).c_str(), + printType(pPowerTelemetry.gpuTemperaturePercent.type).c_str()); + } + + for (int i = 0; i < CTL_FAN_COUNT; i++) + { + if (pPowerTelemetry.fanSpeed[i].bSupported) + { + PRINT_LOGS("\nFan[%d] Speed: %f (%s) Datatype:(%s)", i, pPowerTelemetry.fanSpeed[i].value.datadouble, printUnits(pPowerTelemetry.fanSpeed[i].units).c_str(), + printType(pPowerTelemetry.fanSpeed[i].type).c_str()); + } + } + + PRINT_LOGS("\ngpuPowerLimited: %s", ((pPowerTelemetry.gpuPowerLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuTemperatureLimited: %s", ((pPowerTelemetry.gpuTemperatureLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuCurrentLimited: %s", ((pPowerTelemetry.gpuCurrentLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuVoltageLimited: %s", ((pPowerTelemetry.gpuVoltageLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuUtilizationLimited: %s", ((pPowerTelemetry.gpuUtilizationLimited) ? "true" : "false")); } else { - PRINT_LOGS("\nError: %s \n \n", DecodeRetCode(Status).c_str()); + PRINT_LOGS("\nOverclockPowerTelemetry => ctlPowerTelemetryGet Result Error: %s, ErrorCode: 0x%x \n \n", DecodeRetCode(Status).c_str(), Status); } } @@ -777,7 +1058,6 @@ int main() { ctl_result_t Result = CTL_RESULT_SUCCESS; ctl_device_adapter_handle_t *hDevices = nullptr; - ctl_display_output_handle_t *hDisplayOutput = nullptr; ctl_device_adapter_properties_t StDeviceAdapterProperties = { 0 }; ctl_init_args_t CtlInitArgs; ctl_api_handle_t hAPIHandle; @@ -869,11 +1149,7 @@ int main() if (CTL_DEVICE_TYPE_GRAPHICS != StDeviceAdapterProperties.device_type) { PRINT_LOGS("This is not a Graphics device \n"); - - if (NULL != StDeviceAdapterProperties.pDeviceID) - { - free(StDeviceAdapterProperties.pDeviceID); - } + CTL_FREE_MEM(StDeviceAdapterProperties.pDeviceID); continue; } @@ -893,28 +1169,29 @@ int main() PRINT_LOGS("Rev id 0x%X\n", StDeviceAdapterProperties.rev_id); } - OverclockProperties(hDevices[Index]); - OverclockFrequencyOffset(hDevices[Index]); - OverclockVoltageOffset(hDevices[Index]); - OverclockLockFrequency(hDevices[Index]); - OverclockPowerLimit(hDevices[Index]); - OverclockTemperatureLimit(hDevices[Index]); - - // Telemetry - // Polling during 1 second at 100 ms - for (uint32_t i = 0; i < 10; i++) + try { - try + OverclockProperties(hDevices[Index]); + OverclockFrequencyOffset(hDevices[Index]); + OverclockVoltageOffset(hDevices[Index]); + OverclockLockFrequency(hDevices[Index]); + OverclockPowerLimit(hDevices[Index]); + OverclockTemperatureLimit(hDevices[Index]); + OverclockVramMemSpeedLimit(hDevices[Index]); + OverclockVFCurveReadWrite(hDevices[Index]); + + // Telemetry + // Polling for 4 seconds with 200 ms sampling interval + for (uint32_t i = 0; i < 20; i++) { OverclockPowerTelemetry(hDevices[Index]); + Sleep(200); } - catch (const std::bad_array_new_length &e) - { - printf("%s \n", e.what()); - } - Sleep(100); } - + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } CTL_FREE_MEM(StDeviceAdapterProperties.pDeviceID); } } @@ -922,131 +1199,7 @@ int main() Exit: - if (ctlClose(hAPIHandle) != ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nError: %s", DecodeRetCode(ctlClose(hAPIHandle)).c_str()); - return 0; - } - - CTL_FREE_MEM(hDisplayOutput); + ctlClose(hAPIHandle); CTL_FREE_MEM(hDevices); return 0; } - -// Decoding the return code for the most common error codes. -std::string DecodeRetCode(ctl_result_t Res) -{ - switch (Res) - { - case CTL_RESULT_SUCCESS: - { - return std::string("[CTL_RESULT_SUCCESS]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE]"); - } - case CTL_RESULT_ERROR_GENERIC_START: - { - return std::string("[CTL_RESULT_ERROR_GENERIC_START]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET]"); - } - case CTL_RESULT_ERROR_NOT_INITIALIZED: - { - return std::string("[CTL_RESULT_ERROR_NOT_INITIALIZED]"); - } - case CTL_RESULT_ERROR_ALREADY_INITIALIZED: - { - return std::string("[CTL_RESULT_ERROR_ALREADY_INITIALIZED]"); - } - case CTL_RESULT_ERROR_DEVICE_LOST: - { - return std::string("[CTL_RESULT_ERROR_DEVICE_LOST]"); - } - case CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS: - { - return std::string("[CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS]"); - } - case CTL_RESULT_ERROR_NOT_AVAILABLE: - { - return std::string("[CTL_RESULT_ERROR_NOT_AVAILABLE]"); - } - case CTL_RESULT_ERROR_UNINITIALIZED: - { - return std::string("[CTL_RESULT_ERROR_UNINITIALIZED]"); - } - case CTL_RESULT_ERROR_UNSUPPORTED_VERSION: - { - return std::string("[CTL_RESULT_ERROR_UNSUPPORTED_VERSION]"); - } - case CTL_RESULT_ERROR_UNSUPPORTED_FEATURE: - { - return std::string("[CTL_RESULT_ERROR_UNSUPPORTED_FEATURE]"); - } - case CTL_RESULT_ERROR_INVALID_ARGUMENT: - { - return std::string("[CTL_RESULT_ERROR_INVALID_ARGUMENT]"); - } - case CTL_RESULT_ERROR_INVALID_NULL_HANDLE: - { - return std::string("[CTL_RESULT_ERROR_INVALID_NULL_HANDLE]"); - } - case CTL_RESULT_ERROR_INVALID_NULL_POINTER: - { - return std::string("[CTL_RESULT_ERROR_INVALID_NULL_POINTER]"); - } - case CTL_RESULT_ERROR_INVALID_SIZE: - { - return std::string("[CTL_RESULT_ERROR_INVALID_SIZE]"); - } - case CTL_RESULT_ERROR_UNSUPPORTED_SIZE: - { - return std::string("[CTL_RESULT_ERROR_UNSUPPORTED_SIZE]"); - } - case CTL_RESULT_ERROR_NOT_IMPLEMENTED: - { - return std::string("[CTL_RESULT_ERROR_NOT_IMPLEMENTED]"); - } - case CTL_RESULT_ERROR_ZE_LOADER: - { - return std::string("[CTL_RESULT_ERROR_ZE_LOADER]"); - } - case CTL_RESULT_ERROR_INVALID_OPERATION_TYPE: - { - return std::string("[CTL_RESULT_ERROR_INVALID_OPERATION_TYPE]"); - } - case CTL_RESULT_ERROR_UNKNOWN: - { - return std::string("[CTL_RESULT_ERROR_UNKNOWN]"); - } - default: - return std::string("[Unknown Error]"); - } -} \ No newline at end of file diff --git a/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp b/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp index bf7a216..d558ecc 100644 --- a/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp +++ b/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp @@ -62,12 +62,12 @@ ctl_result_t TestPSRPowerFeature(ctl_display_output_handle_t hDisplayOutput) if (CTL_POWER_OPTIMIZATION_FLAG_PSR != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_PSR)) { - printf("PSR is not supported\n"); + APP_LOG_WARN("PSR is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("PSR is supported\n"); + APP_LOG_INFO("PSR is supported"); // Set Current PowerFeature Result = ctlSetPowerOptimizationSetting(hDisplayOutput, &NewPowerSettings); @@ -76,7 +76,7 @@ ctl_result_t TestPSRPowerFeature(ctl_display_output_handle_t hDisplayOutput) // Get Applied PowerFeature Result = ctlGetPowerOptimizationSetting(hDisplayOutput, &AppliedPowerSettings); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationSetting (PSR)"); - printf("PSR Enable = %d\n", AppliedPowerSettings.Enable); + APP_LOG_INFO("PSR Enable = %d", AppliedPowerSettings.Enable); Exit: return Result; @@ -106,7 +106,7 @@ ctl_result_t TestDPSTPowerFeature(ctl_display_output_handle_t hDisplayOutput) if (CTL_POWER_OPTIMIZATION_FLAG_DPST != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_DPST)) { - printf("DPST is not supported\n"); + APP_LOG_WARN("DPST is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } @@ -116,19 +116,19 @@ ctl_result_t TestDPSTPowerFeature(ctl_display_output_handle_t hDisplayOutput) if (CTL_POWER_OPTIMIZATION_DPST_FLAG_BKLT != (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.SupportedFeatures & CTL_POWER_OPTIMIZATION_DPST_FLAG_BKLT)) { - printf("BKLT is not supported\n"); + APP_LOG_WARN("BKLT is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("DPST is supported\n"); - printf("DPST Enable = %d\n", AppliedPowerSettings.Enable); - printf("DPST MinLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); - printf("DPST MaxLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); + APP_LOG_INFO("DPST is supported"); + APP_LOG_INFO("DPST Enable = %d", AppliedPowerSettings.Enable); + APP_LOG_INFO("DPST MinLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); + APP_LOG_INFO("DPST MaxLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); if (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures & CTL_POWER_OPTIMIZATION_DPST_FLAG_EPSM) { - printf("DPST EPSM enabled\n"); + APP_LOG_INFO("DPST EPSM enabled"); } uint8_t Levels[2] = { AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel, AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel }; @@ -153,7 +153,7 @@ ctl_result_t TestDPSTPowerFeature(ctl_display_output_handle_t hDisplayOutput) if (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level != NewPowerSettings.FeatureSpecificData.DPSTInfo.Level) { - printf("Current and Applied levels mismatched: %d, %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); + APP_LOG_ERROR("Current and Applied levels mismatched: %d, %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); } } @@ -189,15 +189,15 @@ ctl_result_t TestOPSTPowerFeature(ctl_display_output_handle_t hDisplayOutput) if ((CTL_POWER_OPTIMIZATION_FLAG_DPST != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_DPST)) || (CTL_POWER_OPTIMIZATION_DPST_FLAG_OPST != (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.SupportedFeatures & CTL_POWER_OPTIMIZATION_DPST_FLAG_OPST))) { - printf("OPST is not supported\n"); + APP_LOG_WARN("OPST is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("OPST is supported\n"); - printf("GetPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_OPST\n"); - printf("OPST MinLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); - printf("OPST MaxLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); + APP_LOG_INFO("OPST is supported"); + APP_LOG_INFO("GetPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_OPST"); + APP_LOG_INFO("OPST MinLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); + APP_LOG_INFO("OPST MaxLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); NewPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; @@ -222,7 +222,7 @@ ctl_result_t TestOPSTPowerFeature(ctl_display_output_handle_t hDisplayOutput) if (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level != NewPowerSettings.FeatureSpecificData.DPSTInfo.Level) { - printf("Current and Applied levels mismatched: %d, %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); + APP_LOG_ERROR("Current and Applied levels mismatched: %d, %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); } } @@ -258,14 +258,14 @@ ctl_result_t TestELPPowerFeature(ctl_display_output_handle_t hDisplayOutput) if ((CTL_POWER_OPTIMIZATION_FLAG_DPST != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_DPST)) || (CTL_POWER_OPTIMIZATION_DPST_FLAG_ELP != (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.SupportedFeatures & CTL_POWER_OPTIMIZATION_DPST_FLAG_ELP))) { - printf("ELP is not supported\n"); + APP_LOG_WARN("ELP is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("GetPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_ELP\n"); - printf("ELP MinLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); - printf("ELP MaxLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); + APP_LOG_INFO("GetPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_ELP"); + APP_LOG_INFO("ELP MinLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); + APP_LOG_INFO("ELP MaxLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); uint8_t Levels[2] = { AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel, AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel }; NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); @@ -288,7 +288,7 @@ ctl_result_t TestELPPowerFeature(ctl_display_output_handle_t hDisplayOutput) if (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level != NewPowerSettings.FeatureSpecificData.DPSTInfo.Level) { - printf("Current and Applied levels mismatched: %d, %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); + APP_LOG_ERROR("Current and Applied levels mismatched: %d, %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); } } @@ -349,11 +349,11 @@ ctl_result_t TestBrightnessControl(ctl_display_output_handle_t hDisplayOutput) if (AppliedBrightnessSettings.TargetBrightness != NewBrightnessSettings.TargetBrightness) { - printf("Current and Applied TargetBrightness mismatched: %d, %d\n", AppliedBrightnessSettings.TargetBrightness, NewBrightnessSettings.TargetBrightness); + APP_LOG_ERROR("Current and Applied TargetBrightness mismatched: %d, %d", AppliedBrightnessSettings.TargetBrightness, NewBrightnessSettings.TargetBrightness); } - printf("Current brightness = %d\n", AppliedBrightnessSettings.CurrentBrightness); - printf("Target brightness = %d\n", AppliedBrightnessSettings.TargetBrightness); + APP_LOG_INFO("Current brightness = %d", AppliedBrightnessSettings.CurrentBrightness); + APP_LOG_INFO("Target brightness = %d", AppliedBrightnessSettings.TargetBrightness); } else { @@ -391,13 +391,13 @@ ctl_result_t TestApdPowerFeature(ctl_display_output_handle_t hDisplayOutput) if ((CTL_POWER_OPTIMIZATION_FLAG_DPST != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_DPST)) || (CTL_POWER_OPTIMIZATION_DPST_FLAG_APD != (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.SupportedFeatures & CTL_POWER_OPTIMIZATION_DPST_FLAG_APD))) { - printf("APD is not supported\n"); + APP_LOG_WARN("APD is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("APD MinLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); - printf("APD MaxLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); + APP_LOG_INFO("APD MinLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); + APP_LOG_INFO("APD MaxLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); uint8_t Levels[2] = { AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel, AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel }; @@ -420,7 +420,7 @@ ctl_result_t TestApdPowerFeature(ctl_display_output_handle_t hDisplayOutput) if (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level != NewPowerSettings.FeatureSpecificData.DPSTInfo.Level) { - printf("Current and Applied levels mismatched: %d, %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); + APP_LOG_ERROR("Current and Applied levels mismatched: %d, %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); } } @@ -455,7 +455,7 @@ ctl_result_t TestPixOptixPowerFeature(ctl_display_output_handle_t hDisplayOutput if ((CTL_POWER_OPTIMIZATION_FLAG_DPST != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_DPST)) || (CTL_POWER_OPTIMIZATION_DPST_FLAG_PIXOPTIX != (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.SupportedFeatures & CTL_POWER_OPTIMIZATION_DPST_FLAG_PIXOPTIX))) { - printf("PIXOPTIX is not supported\n"); + APP_LOG_WARN("PIXOPTIX is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } @@ -474,11 +474,11 @@ ctl_result_t TestPixOptixPowerFeature(ctl_display_output_handle_t hDisplayOutput if (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures & CTL_POWER_OPTIMIZATION_DPST_FLAG_PIXOPTIX) { - printf("PIXOPTIX is enabled"); + APP_LOG_INFO("PIXOPTIX is enabled"); } else { - printf("PIXOPTIX is not enabled"); + APP_LOG_ERROR("PIXOPTIX is not enabled"); } Exit: @@ -512,11 +512,11 @@ ctl_result_t TestAlrrFeature(ctl_display_output_handle_t hDisplayOutput) if (PowerOptimizationSetting.FeatureSpecificData.LRRInfo.CurrentLRRTypes & CTL_POWER_OPTIMIZATION_LRR_FLAG_ALRR) { - printf("ALRR is enabled"); + APP_LOG_INFO("ALRR is enabled"); } else { - printf("ALRR is not enabled"); + APP_LOG_WARN("ALRR is not enabled"); } } @@ -542,13 +542,13 @@ ctl_result_t TestFbcPowerFeature(ctl_display_output_handle_t hDisplayOutput) if (CTL_POWER_OPTIMIZATION_FLAG_FBC != (PowerOptimizationCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_FBC)) { - printf("FBC is not supported\n"); + APP_LOG_WARN("FBC is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } else { - printf("FBC is supported\n"); + APP_LOG_INFO("FBC is supported"); } if (PowerOptimizationCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_FBC) @@ -558,7 +558,7 @@ ctl_result_t TestFbcPowerFeature(ctl_display_output_handle_t hDisplayOutput) Result = ctlGetPowerOptimizationSetting(hDisplayOutput, &PowerOptimizationSetting); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationSetting"); - printf("FBC Enable Status= %d\n", PowerOptimizationSetting.Enable); + APP_LOG_INFO("FBC Enable Status= %d", PowerOptimizationSetting.Enable); } Exit: @@ -593,14 +593,14 @@ ctl_result_t TestCABCPowerFeature(ctl_display_output_handle_t hDisplayOutput) if ((CTL_POWER_OPTIMIZATION_FLAG_DPST != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_DPST)) || (CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC != (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.SupportedFeatures & CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC))) { - printf("CABC is not supported\n"); + APP_LOG_WARN("CABC is not supported"); Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; goto Exit; } - printf("GetPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC\n"); - printf("CABC MinLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); - printf("CABC MaxLevel = %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); + APP_LOG_INFO("GetPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC"); + APP_LOG_INFO("CABC MinLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel); + APP_LOG_INFO("CABC MaxLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); uint8_t Levels[2] = { AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel, AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel }; NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); @@ -623,7 +623,7 @@ ctl_result_t TestCABCPowerFeature(ctl_display_output_handle_t hDisplayOutput) if (AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level != NewPowerSettings.FeatureSpecificData.DPSTInfo.Level) { - printf("Current and Applied levels mismatched: %d, %d\n", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); + APP_LOG_ERROR("Current and Applied levels mismatched: %d, %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.Level, NewPowerSettings.FeatureSpecificData.DPSTInfo.Level); } } @@ -657,12 +657,12 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput if (FALSE == IsDisplayAttached) { - printf("Display %d is not attached, skipping the call for this display\n", DisplayIndex); + APP_LOG_WARN("Display %d is not attached, skipping the call for this display", DisplayIndex); continue; } else { - printf("Attached Display Count: %d\n", DisplayIndex); + APP_LOG_INFO("Attached Display Count: %d", DisplayIndex); } // NOTE: Currently DPST/ELP/OPST combination is not supported @@ -732,13 +732,13 @@ ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } else if (DisplayCount <= 0) { - printf("Invalid Display Count. skipping display enumration for adapter:%d\n", AdapterIndex); + APP_LOG_WARN("Invalid Display Count. skipping display enumration for adapter:%d", AdapterIndex); continue; } @@ -750,7 +750,7 @@ ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -760,7 +760,7 @@ ctl_result_t EnumerateTargetDisplays(ctl_display_output_handle_t *hDisplayOutput if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateDisplayHandles returned failure code: 0x%X\n", Result); + APP_LOG_WARN("EnumerateDisplayHandles returned failure code: 0x%X", Result); } CTL_FREE_MEM(hDisplayOutput); @@ -803,7 +803,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -815,7 +815,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -828,14 +828,14 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } Result = EnumerateTargetDisplays(hDisplayOutput, AdapterCount, hDevices); if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateTargetDisplays returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateTargetDisplays returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -844,6 +844,6 @@ int main() ctlClose(hAPIHandle); CTL_FREE_MEM(hDisplayOutput); CTL_FREE_MEM(hDevices); - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } diff --git a/Samples/Scaling_Samples/Scaling_App.cpp b/Samples/Scaling_Samples/Scaling_App.cpp index 196f43a..9cc55a0 100644 --- a/Samples/Scaling_Samples/Scaling_App.cpp +++ b/Samples/Scaling_Samples/Scaling_App.cpp @@ -53,7 +53,7 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices, uint8_t ScaleType Result = ctlGetSupportedRetroScalingCapability(hDevices, &RetroScalingCaps); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSupportedRetroScalingCapability"); - printf("ctlGetSupportedRetroScalingCapability returned Caps: 0x%X\n", RetroScalingCaps.SupportedRetroScaling); + APP_LOG_INFO("ctlGetSupportedRetroScalingCapability returned Caps: 0x%X", RetroScalingCaps.SupportedRetroScaling); // Test Integer Scaling RetroScalingSettings.Enable = true; @@ -72,7 +72,7 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices, uint8_t ScaleType Result = ctlGetSetRetroScaling(hDevices, &RetroScalingSettings); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetRetroScaling"); - printf("ctlGetSetRetroScaling returned Enable: 0x%X type:0x%x\n", RetroScalingSettings.Enable, RetroScalingSettings.RetroScalingType); + APP_LOG_INFO("ctlGetSetRetroScaling returned Enable: 0x%X type:0x%x", RetroScalingSettings.Enable, RetroScalingSettings.RetroScalingType); // Enumerate all the possible target display's for the adapters Result = ctlEnumerateDisplayOutputs(hDevices, &DisplayCount, hDisplayOutput); @@ -80,7 +80,7 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices, uint8_t ScaleType if (DisplayCount <= 0) { - printf("Invalid Display Count\n"); + APP_LOG_ERROR("Invalid Display Count"); goto Exit; } @@ -104,34 +104,34 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices, uint8_t ScaleType if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetSupportedScalingCapability returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlGetSupportedScalingCapability returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } - printf("ctlGetSupportedScalingCapability returned caps: 0x%X\n", ScalingCaps.SupportedScaling); + APP_LOG_INFO("ctlGetSupportedScalingCapability returned caps: 0x%X", ScalingCaps.SupportedScaling); - printf("\n******* Supported Scaling types ********\n"); + PRINT_LOGS("******* Supported Scaling types ********"); if (CTL_SCALING_TYPE_FLAG_IDENTITY & ScalingCaps.SupportedScaling) { - printf("CTL_SCALING_TYPE_FLAG_IDENTITY(1) is supported\n"); + APP_LOG_INFO("CTL_SCALING_TYPE_FLAG_IDENTITY(1) is supported"); } if (CTL_SCALING_TYPE_FLAG_CENTERED & ScalingCaps.SupportedScaling) { - printf("CTL_SCALING_TYPE_FLAG_CENTERED(2) is supported\n"); + APP_LOG_INFO("CTL_SCALING_TYPE_FLAG_CENTERED(2) is supported"); } if (CTL_SCALING_TYPE_FLAG_STRETCHED & ScalingCaps.SupportedScaling) { - printf("CTL_SCALING_TYPE_FLAG_STRETCHED(4) is supported\n"); + APP_LOG_INFO("CTL_SCALING_TYPE_FLAG_STRETCHED(4) is supported"); } if (CTL_SCALING_TYPE_FLAG_ASPECT_RATIO_CENTERED_MAX & ScalingCaps.SupportedScaling) { - printf("CTL_SCALING_TYPE_FLAG_ASPECT_RATIO_CENTERED_MAX(8) is supported\n"); + APP_LOG_INFO("CTL_SCALING_TYPE_FLAG_ASPECT_RATIO_CENTERED_MAX(8) is supported"); } if (CTL_SCALING_TYPE_FLAG_CUSTOM & ScalingCaps.SupportedScaling) { - printf("CTL_SCALING_TYPE_FLAG_CUSTOM(16) is supported\n"); + APP_LOG_INFO("CTL_SCALING_TYPE_FLAG_CUSTOM(16) is supported"); } if (0 != ScalingCaps.SupportedScaling) @@ -142,11 +142,12 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices, uint8_t ScaleType if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetCurrentScaling returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlGetCurrentScaling returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } - printf("ctlGetCurrentScaling returned Enable: 0x%X ScalingType:0x%x PreferredScalingType:0x%x\n", ScalingSetting.Enable, ScalingSetting.ScalingType, ScalingSetting.PreferredScalingType); + APP_LOG_INFO("ctlGetCurrentScaling returned Enable: 0x%X ScalingType:0x%x PreferredScalingType:0x%x", ScalingSetting.Enable, ScalingSetting.ScalingType, + ScalingSetting.PreferredScalingType); } // fill custom scaling details only if it is supported @@ -162,7 +163,7 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices, uint8_t ScaleType ScalingSetting.HardwareModeSet = (TRUE == ModeSet) ? TRUE : FALSE; ScalingSetting.Version = 1; - printf("*** PerX:%d PerY:%d ***\n", PerX, PerY); + APP_LOG_INFO("*** PerX:%d PerY:%d ***", PerX, PerY); ScalingSetting.CustomScalingX = PerX; ScalingSetting.CustomScalingY = PerY; @@ -177,13 +178,13 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices, uint8_t ScaleType ScalingSetting.Version = 1; } - printf("ScalingSetting.ScalingType:%d\n", ScalingSetting.ScalingType); + APP_LOG_INFO("ScalingSetting.ScalingType:%d", ScalingSetting.ScalingType); Result = ctlSetCurrentScaling(hDisplayOutput[i], &ScalingSetting); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlSetCurrentScaling returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlSetCurrentScaling returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } @@ -194,17 +195,17 @@ ctl_result_t ScalingTest(ctl_device_adapter_handle_t hDevices, uint8_t ScaleType Result = ctlGetCurrentScaling(hDisplayOutput[i], &ScalingSetting); if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetCurrentScaling returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlGetCurrentScaling returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } - printf("ctlGetCurrentScaling returned Enable: 0x%X ScalingType:0x%x PreferredScalingType:0x%x\n", ScalingSetting.Enable, ScalingSetting.ScalingType, ScalingSetting.PreferredScalingType); + APP_LOG_INFO("ctlGetCurrentScaling returned Enable: 0x%X ScalingType:0x%x PreferredScalingType:0x%x", ScalingSetting.Enable, ScalingSetting.ScalingType, ScalingSetting.PreferredScalingType); if (CTL_SCALING_TYPE_FLAG_CUSTOM == ScalingSetting.ScalingType) { - printf("ScalingSetting.CustomScalingX:%d\n", ScalingSetting.CustomScalingX); - printf("ScalingSetting.CustomScalingY:%d\n", ScalingSetting.CustomScalingY); + APP_LOG_INFO("ScalingSetting.CustomScalingX:%d", ScalingSetting.CustomScalingX); + APP_LOG_INFO("ScalingSetting.CustomScalingY:%d", ScalingSetting.CustomScalingY); } } @@ -226,7 +227,7 @@ int main(int argc, char *pArgv[]) if (argc < 2) { - printf("Enter Scale type!\""); + APP_LOG_ERROR("Enter Scale type!\""); return 0; } @@ -272,7 +273,7 @@ int main(int argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -284,7 +285,7 @@ int main(int argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -297,7 +298,7 @@ int main(int argc, char *pArgv[]) } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } for (uint32_t i = 0; i < AdapterCount; i++) @@ -306,7 +307,7 @@ int main(int argc, char *pArgv[]) if (CTL_RESULT_SUCCESS != Result) { - printf("ctlGetCurrentScaling returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlGetCurrentScaling returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } @@ -316,6 +317,6 @@ int main(int argc, char *pArgv[]) ctlClose(hAPIHandle); CTL_FREE_MEM(hDevices); - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } \ No newline at end of file diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index 2ec51dd..dc9739b 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -22,16 +22,11 @@ #include #include #include - -#include #include - -#include -#include #include "igcl_api.h" #include "GenericIGCLApp.h" +#include -std::string DecodeRetCode(ctl_result_t Res); void CtlTemperatureTest(ctl_device_adapter_handle_t hDAhandle); void CtlFrequencyTest(ctl_device_adapter_handle_t hDAhandle); void CtlPowerTest(ctl_device_adapter_handle_t hDAhandle); @@ -40,169 +35,102 @@ void CtlFanTest(ctl_device_adapter_handle_t hDAhandle); void CtlPciTest(ctl_device_adapter_handle_t hDAhandle); void CtlMemoryTest(ctl_device_adapter_handle_t hDAhandle); void CtlEngineTest(ctl_device_adapter_handle_t hDAhandle); -void CtlOverclockPropertiesTest(ctl_device_adapter_handle_t hDAhandle); -void CtlOverclockFrequencyOffsetTest(ctl_device_adapter_handle_t hDAhandle, double FreqOffset); -void CtlOverclockFrequencyAndVoltageOffsetTest(ctl_device_adapter_handle_t hDAhandle); -void CtlOverclockPowerTest(ctl_device_adapter_handle_t hDAhandle); -void CtlOverclockTemperatureTest(ctl_device_adapter_handle_t hDAhandle); +void CtlLedTest(ctl_device_adapter_handle_t hDAhandle); void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle); -const char *printType(ctl_data_type_t Type) +std::string printType(ctl_data_type_t Type) { - switch (Type) - { - case ctl_data_type_t::CTL_DATA_TYPE_INT8: - { - return "CTL_DATA_TYPE_INT8"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_UINT8: - { - return "CTL_DATA_TYPE_UINT8"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_INT16: - { - return "CTL_DATA_TYPE_INT16"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_UINT16: - { - return "CTL_DATA_TYPE_UINT16"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_INT32: - { - return "CTL_DATA_TYPE_INT32"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_UINT32: - { - return "CTL_DATA_TYPE_UINT32"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_INT64: - { - return "CTL_DATA_TYPE_INT64"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_UINT64: - { - return "CTL_DATA_TYPE_UINT64"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_FLOAT: - { - return "CTL_DATA_TYPE_FLOAT"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_DOUBLE: - { - return "CTL_DATA_TYPE_DOUBLE"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_STRING_ASCII: - { - return "CTL_DATA_TYPE_STRING_ASCII"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_STRING_UTF16: - { - return "CTL_DATA_TYPE_STRING_UTF16"; - } - break; - case ctl_data_type_t::CTL_DATA_TYPE_STRING_UTF132: - { - return "CTL_DATA_TYPE_STRING_UTF132"; - } - break; - default: - return "Unknown units"; - } + static const std::map dataTypeStringMap = { { CTL_DATA_TYPE_INT8, "INT8" }, + { CTL_DATA_TYPE_UINT8, "UINT8" }, + { CTL_DATA_TYPE_INT16, "INT16" }, + { CTL_DATA_TYPE_UINT16, "UINT16" }, + { CTL_DATA_TYPE_INT32, "INT32" }, + { CTL_DATA_TYPE_UINT32, "UINT32" }, + { CTL_DATA_TYPE_INT64, "INT64" }, + { CTL_DATA_TYPE_UINT64, "UINT64" }, + { CTL_DATA_TYPE_FLOAT, "FLOAT" }, + { CTL_DATA_TYPE_DOUBLE, "DOUBLE" }, + { CTL_DATA_TYPE_STRING_ASCII, "STRING_ASCII" }, + { CTL_DATA_TYPE_STRING_UTF16, "STRING_UTF16" }, + { CTL_DATA_TYPE_STRING_UTF132, "STRING_UTF132" } }; + + auto it = dataTypeStringMap.find(Type); + if (it != dataTypeStringMap.end()) + { + return it->second; + } + return "Unknown datatype"; } -const char *printUnits(ctl_units_t Units) +std::string printUnits(ctl_units_t Units) { - switch (Units) - { - case ctl_units_t::CTL_UNITS_FREQUENCY_MHZ: - { - return "Frequency in MHz"; - } - break; - case ctl_units_t::CTL_UNITS_OPERATIONS_GTS: - { - return "GigaOperations per Second"; - } - break; - case ctl_units_t::CTL_UNITS_OPERATIONS_MTS: - { - return "MegaOperations per Second"; - } - break; - case ctl_units_t::CTL_UNITS_VOLTAGE_VOLTS: - { - return "Voltage in Volts"; - } - break; - case ctl_units_t::CTL_UNITS_POWER_WATTS: - { - return "Power in Watts"; - } - break; - case ctl_units_t::CTL_UNITS_TEMPERATURE_CELSIUS: - { - return "Temperature in Celsius"; - } - break; - case ctl_units_t::CTL_UNITS_ENERGY_JOULES: - { - return "Energy in Joules"; - } - break; - case ctl_units_t::CTL_UNITS_TIME_SECONDS: - { - return "Time in Seconds"; - } - break; - case ctl_units_t::CTL_UNITS_MEMORY_BYTES: - { - return "Memory in Bytes"; - } - break; - case ctl_units_t::CTL_UNITS_ANGULAR_SPEED_RPM: - { - return "Angular Speed in RPM"; - } - break; - case ctl_units_t::CTL_UNITS_POWER_MILLIWATTS: - { - return "Power in Milli Watts"; - } - break; - case ctl_units_t::CTL_UNITS_PERCENT: - { - return "Units in Percentage"; - } - break; - case ctl_units_t::CTL_UNITS_MEM_SPEED_GBPS: - { - return "Units in Gigabyte Per Second"; - } - break; - case ctl_units_t::CTL_UNITS_VOLTAGE_MILLIVOLTS: - { - return "Voltage in MilliVolts"; - } - case ctl_units_t::CTL_UNITS_BANDWIDTH_MBPS: - { - return "Bandwidth in MegaBytes Per Second"; - } - break; - default: - return "Unknown units"; - } + static const std::map unitsStringMap = { { CTL_UNITS_FREQUENCY_MHZ, "Frequency in MHz" }, + { CTL_UNITS_OPERATIONS_GTS, "GigaOperations per Second" }, + { CTL_UNITS_OPERATIONS_MTS, "MegaOperations per Second" }, + { CTL_UNITS_VOLTAGE_VOLTS, "Voltage in Volts" }, + { CTL_UNITS_POWER_WATTS, "Power in Watts" }, + { CTL_UNITS_TEMPERATURE_CELSIUS, "Temperature in Celsius" }, + { CTL_UNITS_ENERGY_JOULES, "Energy in Joules" }, + { CTL_UNITS_TIME_SECONDS, "Time in Seconds" }, + { CTL_UNITS_MEMORY_BYTES, "Memory in Bytes" }, + { CTL_UNITS_ANGULAR_SPEED_RPM, "Angular Speed in RPM" }, + { CTL_UNITS_POWER_MILLIWATTS, "Power in Milli Watts" }, + { CTL_UNITS_PERCENT, "Units in Percentage" }, + { CTL_UNITS_MEM_SPEED_GBPS, "Units in Gigabyte Per Second" }, + { CTL_UNITS_VOLTAGE_MILLIVOLTS, "Voltage in MilliVolts" }, + { CTL_UNITS_BANDWIDTH_MBPS, "Bandwidth in MegaBytes Per Second" } }; + + auto it = unitsStringMap.find(Units); + if (it != unitsStringMap.end()) + { + return it->second; + } + return "Unknown unit"; } + +// Decoding the return code for the most common error codes. +std::string DecodeRetCode(ctl_result_t Res) +{ + static const std::map retCodeMap = { { CTL_RESULT_SUCCESS, "[CTL_RESULT_SUCCESS]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE]" }, + { CTL_RESULT_ERROR_GENERIC_START, "[CTL_RESULT_ERROR_GENERIC_START]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET]" }, + { CTL_RESULT_ERROR_NOT_INITIALIZED, "[CTL_RESULT_ERROR_NOT_INITIALIZED]" }, + { CTL_RESULT_ERROR_ALREADY_INITIALIZED, "[CTL_RESULT_ERROR_ALREADY_INITIALIZED]" }, + { CTL_RESULT_ERROR_DEVICE_LOST, "[CTL_RESULT_ERROR_DEVICE_LOST]" }, + { CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS, "[CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS]" }, + { CTL_RESULT_ERROR_NOT_AVAILABLE, "[CTL_RESULT_ERROR_NOT_AVAILABLE]" }, + { CTL_RESULT_ERROR_UNINITIALIZED, "[CTL_RESULT_ERROR_UNINITIALIZED]" }, + { CTL_RESULT_ERROR_UNSUPPORTED_VERSION, "[CTL_RESULT_ERROR_UNSUPPORTED_VERSION]" }, + { CTL_RESULT_ERROR_UNSUPPORTED_FEATURE, "[CTL_RESULT_ERROR_UNSUPPORTED_FEATURE]" }, + { CTL_RESULT_ERROR_INVALID_ARGUMENT, "[CTL_RESULT_ERROR_INVALID_ARGUMENT]" }, + { CTL_RESULT_ERROR_INVALID_NULL_HANDLE, "[CTL_RESULT_ERROR_INVALID_NULL_HANDLE]" }, + { CTL_RESULT_ERROR_INVALID_NULL_POINTER, "[CTL_RESULT_ERROR_INVALID_NULL_POINTER]" }, + { CTL_RESULT_ERROR_INVALID_SIZE, "[CTL_RESULT_ERROR_INVALID_SIZE]" }, + { CTL_RESULT_ERROR_UNSUPPORTED_SIZE, "[CTL_RESULT_ERROR_UNSUPPORTED_SIZE]" }, + { CTL_RESULT_ERROR_NOT_IMPLEMENTED, "[CTL_RESULT_ERROR_NOT_IMPLEMENTED]" }, + { CTL_RESULT_ERROR_ZE_LOADER, "[CTL_RESULT_ERROR_ZE_LOADER]" }, + { CTL_RESULT_ERROR_INVALID_OPERATION_TYPE, "[CTL_RESULT_ERROR_INVALID_OPERATION_TYPE]" }, + { CTL_RESULT_ERROR_DATA_READ, "[CTL_RESULT_ERROR_DATA_READ]" }, + { CTL_RESULT_ERROR_DATA_WRITE, "[CTL_RESULT_ERROR_DATA_WRITE]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_INVALID_CUSTOM_VF_CURVE, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_INVALID_CUSTOM_VF_CURVE]" }, + { CTL_RESULT_ERROR_UNKNOWN, "[CTL_RESULT_ERROR_UNKNOWN]" }, + { CTL_RESULT_ERROR_CORE_OVERCLOCK_DEPRECATED_API, "[CTL_RESULT_ERROR_CORE_OVERCLOCK_DEPRECATED_API]" } }; + + auto it = retCodeMap.find(Res); + if (it != retCodeMap.end()) + { + return it->second; + } + return "[Unknown Error]"; +} + /*************************************************************** * @brief * place_holder_for_Detailed_desc @@ -932,631 +860,297 @@ void CtlEngineTest(ctl_device_adapter_handle_t hDAhandle) } /*************************************************************** - * @brief - * place_holder_for_Detailed_desc - * @param - * @return - ***************************************************************/ -void CtlOverclockPropertiesTest(ctl_device_adapter_handle_t hDAhandle) -{ - - ctl_oc_properties_t OcProperties = {}; - OcProperties.Size = sizeof(ctl_oc_properties_t); - ctl_result_t status = ctlOverclockGetProperties(hDAhandle, &OcProperties); - - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - - PRINT_LOGS("\nOc Supported? %s", ((OcProperties.bSupported) ? "true" : "false")); - - PRINT_LOGS("\nGpu Frequency Offset Supported? %s", ((OcProperties.gpuFrequencyOffset.bSupported) ? "true" : "false")); - PRINT_LOGS("\nGpu Frequency Offset Is Relative? %s", ((OcProperties.gpuFrequencyOffset.bRelative) ? "true" : "false")); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", ((OcProperties.gpuFrequencyOffset.bReference) ? "true" : "false")); - PRINT_LOGS("\nGpu Frequency Offset Default: %f", OcProperties.gpuFrequencyOffset.Default); - PRINT_LOGS("\nGpu Frequency Offset Min: %f", OcProperties.gpuFrequencyOffset.min); - PRINT_LOGS("\nGpu Frequency Offset Max: %f", OcProperties.gpuFrequencyOffset.max); - PRINT_LOGS("\nGpu Frequency Offset Reference: %f", OcProperties.gpuFrequencyOffset.reference); - PRINT_LOGS("\nGpu Frequency Offset Step: %f", OcProperties.gpuFrequencyOffset.step); - PRINT_LOGS("\nGpu Frequency Offset Units: %s", printUnits(OcProperties.gpuFrequencyOffset.units)); - - PRINT_LOGS("\nGpu Voltage Offset Supported? %s", ((OcProperties.gpuVoltageOffset.bSupported) ? "true" : "false")); - PRINT_LOGS("\nGpu Voltage Offset Is Relative? %s", ((OcProperties.gpuVoltageOffset.bRelative) ? "true" : "false")); - PRINT_LOGS("\nGpu Voltage Offset Have Reference? %s", ((OcProperties.gpuVoltageOffset.bReference) ? "true" : "false")); - PRINT_LOGS("\nGpu Voltage Offset Default: %f", OcProperties.gpuVoltageOffset.Default); - PRINT_LOGS("\nGpu Voltage Offset Min: %f", OcProperties.gpuVoltageOffset.min); - PRINT_LOGS("\nGpu Voltage Offset Max: %f", OcProperties.gpuVoltageOffset.max); - PRINT_LOGS("\nGpu Voltage Offset Reference: %f", OcProperties.gpuVoltageOffset.reference); - PRINT_LOGS("\nGpu Voltage Offset Step: %f", OcProperties.gpuVoltageOffset.step); - PRINT_LOGS("\nGpu Voltage Offset Units: %s", printUnits(OcProperties.gpuVoltageOffset.units)); - - PRINT_LOGS("\nPower Limit Supported? %s", ((OcProperties.powerLimit.bSupported) ? "true" : "false")); - PRINT_LOGS("\nPower Limit Is Relative? %s", ((OcProperties.powerLimit.bRelative) ? "true" : "false")); - PRINT_LOGS("\nPower Limit Have Reference? %s", ((OcProperties.powerLimit.bReference) ? "true" : "false")); - PRINT_LOGS("\nPower Limit Default: %f", OcProperties.powerLimit.Default); - PRINT_LOGS("\nPower Limit Min: %f", OcProperties.powerLimit.min); - PRINT_LOGS("\nPower Limit Max: %f", OcProperties.powerLimit.max); - PRINT_LOGS("\nPower Limit Reference: %f", OcProperties.powerLimit.reference); - PRINT_LOGS("\nPower Limit Step: %f", OcProperties.powerLimit.step); - PRINT_LOGS("\nPower Limit Units: %s", printUnits(OcProperties.powerLimit.units)); - - PRINT_LOGS("\nTemperature Limit Supported? %s", ((OcProperties.temperatureLimit.bSupported) ? "true" : "false")); - PRINT_LOGS("\nTemperature Limit Is Relative? %s", ((OcProperties.temperatureLimit.bRelative) ? "true" : "false")); - PRINT_LOGS("\nTemperature Limit Have Reference? %s", ((OcProperties.temperatureLimit.bReference) ? "true" : "false")); - PRINT_LOGS("\nTemperature Limit Default: %f", OcProperties.temperatureLimit.Default); - PRINT_LOGS("\nTemperature Limit Min: %f", OcProperties.temperatureLimit.min); - PRINT_LOGS("\nTemperature Limit Max: %f", OcProperties.temperatureLimit.max); - PRINT_LOGS("\nTemperature Limit Reference: %f", OcProperties.temperatureLimit.reference); - PRINT_LOGS("\nTemperature Limit Step: %f", OcProperties.temperatureLimit.step); - PRINT_LOGS("\nTemperature Limit Units: %s", printUnits(OcProperties.temperatureLimit.units)); - } - else - { - PRINT_LOGS("\nError: %s", DecodeRetCode(status).c_str()); - } - - PRINT_LOGS("\n \n"); -} - -/*************************************************************** - * @brief + * @brief Main Function * place_holder_for_Detailed_desc * @param * @return ***************************************************************/ -void CtlOverclockFrequencyOffsetTest(ctl_device_adapter_handle_t hDAhandle, double FreqOffset) +void CtlLedTest(ctl_device_adapter_handle_t hDAhandle) { - double GPUFrequencyOffset = 0.0; - double VrelOffset = 0.0; - PRINT_LOGS("\n::::::::::::::Overclocking Tests::::::::::::::\n"); - PRINT_LOGS("\n::::::::::::::1.0 Frequency Offset::::::::::::::\n"); - PRINT_LOGS("\n::::::::::::::1.1 Get Frequency Offset::::::::::::::\n"); - PRINT_LOGS("\n1.1.1 Get Frequency Offset:::::::::::::::\n"); - ctl_result_t status = ctlOverclockGpuFrequencyOffsetGet(hDAhandle, &GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - if (GPUFrequencyOffset == 0.0) - { - PRINT_LOGS("\nResult: Overclocking disabled, Frequency Offset is 0"); - } - else - { - PRINT_LOGS("\nResult: Overclocking enabled, Frequency Offset is:%f", GPUFrequencyOffset); - } - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } - - GPUFrequencyOffset = FreqOffset; // Setting Offset to FreqOffset MHz - - PRINT_LOGS("\nSet Frequency Offset with: %f MHz", GPUFrequencyOffset); - status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET) - { - PRINT_LOGS("\nResult: Correctly returned: %s", DecodeRetCode(status).c_str()); - } - else - { - PRINT_LOGS("\nResult: Incorrectly returned: %s", DecodeRetCode(status).c_str()); - } - - status = ctlOverclockWaiverSet(hDAhandle); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Waiver Called correctly"); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + PRINT_LOGS("\n::::::::::::::Print Led Properties::::::::::::::\n"); - PRINT_LOGS("\nSet Frequency Offset with: %f MHz", GPUFrequencyOffset); - status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Frequency Offset Set Correctly "); - } - else - { - PRINT_LOGS("\nResult: Incorrectly returned: %s", DecodeRetCode(status).c_str()); - } + ctl_result_t Result = CTL_RESULT_SUCCESS; + uint32_t LedCount = 0; + ctl_led_handle_t *pLedHandle = nullptr; + uint32_t Index = 0; - status = ctlOverclockGpuFrequencyOffsetGet(hDAhandle, &GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Overclocking enabled, Frequency Offset is:%f", GPUFrequencyOffset); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } - - status = ctlOverclockGpuVoltageOffsetGet(hDAhandle, &VrelOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Overclocking enabled, Voltage Offset is:%f", VrelOffset); - } - else + Result = ctlEnumLeds(hDAhandle, &LedCount, pLedHandle); + if ((Result != CTL_RESULT_SUCCESS) || LedCount == 0) { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } - - GPUFrequencyOffset = 0.0; // Setting Offset to 0 MHz - VrelOffset = 0.0; - - status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Frequency Offset successfully Set to 0"); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } - - status = ctlOverclockGpuVoltageOffsetSet(hDAhandle, VrelOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Voltage Offset successfully Set to 0"); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } - status = ctlOverclockGpuFrequencyOffsetGet(hDAhandle, &GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Overclocking disabled, Frequency Offset is:%f", GPUFrequencyOffset); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } - - status = ctlOverclockGpuVoltageOffsetGet(hDAhandle, &VrelOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Overclocking disabled, Voltage Offset is: %f", VrelOffset); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } - - GPUFrequencyOffset = -FreqOffset; // Setting Offset to -FreqOffset MHz - status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Overclocking enabled, Frequency Offset is:%f", GPUFrequencyOffset); + PRINT_LOGS("\nLed component not supported. Result: %s, LedCount %d", DecodeRetCode(Result).c_str(), LedCount); + return; } else { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); + PRINT_LOGS("\nNumber of Led Handles [%u]", LedCount); } - status = ctlOverclockGpuFrequencyOffsetGet(hDAhandle, &GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) + pLedHandle = (ctl_led_handle_t *)malloc(sizeof(ctl_led_handle_t) * LedCount); + if (pLedHandle == nullptr) { - PRINT_LOGS("\nResult: Overclocking enabled, Frequency Offset is: %f", GPUFrequencyOffset); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); + PRINT_LOGS("\nNull pointer after malloc\n"); + return; } - GPUFrequencyOffset = 0.0; // Setting Offset to 0 MHz - - status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Offset successfully Set to 0"); - } - else + Result = ctlEnumLeds(hDAhandle, &LedCount, pLedHandle); + if (Result != CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); + PRINT_LOGS("\nError: %s for Led handle.", DecodeRetCode(Result).c_str()); + goto cleanUp; } - status = ctlOverclockGpuFrequencyOffsetGet(hDAhandle, &GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) + for (Index = 0; Index < LedCount; Index++) { - PRINT_LOGS("\nResult: Overclocking disabled, Frequency Offset is:%f", GPUFrequencyOffset); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } - - PRINT_LOGS("\n \n"); -} + if (NULL != pLedHandle[Index]) + { + PRINT_LOGS("\n\n[Led] For pLedHandle[%u] = 0x%p\n", Index, pLedHandle[Index]); -/*************************************************************** - * @brief - * place_holder_for_Detailed_desc - * @param - * @return - ***************************************************************/ -void CtlOverclockFrequencyAndVoltageOffsetTest(ctl_device_adapter_handle_t hDAhandle) -{ - double GPUFrequencyOffset = 0.0; - double VrelOffset = 0.0; + PRINT_LOGS("\n[Led] Get Led properties:"); - GPUFrequencyOffset = 100.0; - VrelOffset = 50; // in mV + ctl_led_properties_t LedProperties = { 0 }; + LedProperties.Size = sizeof(ctl_led_properties_t); + Result = ctlLedGetProperties(pLedHandle[Index], &LedProperties); - PRINT_LOGS("\nSet Frequency Offset with: %f MHz Vrel Offset: %f", GPUFrequencyOffset, VrelOffset); + if (Result != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nError: %s from Led get properties.\n", DecodeRetCode(Result).c_str()); + } + else + { + PRINT_LOGS("\n[Led] Can Control [%u]", (uint32_t)LedProperties.canControl); + PRINT_LOGS("\n[Led] Is I2C [%u]", (uint32_t)LedProperties.isI2C); + PRINT_LOGS("\n[Led] Is PWM [%u]", (uint32_t)LedProperties.isPWM); + PRINT_LOGS("\n[Led] Have RGB [%u]", (uint32_t)LedProperties.haveRGB); + } - ctl_result_t status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Frequency Offset Set Correctly "); - } - else - { - PRINT_LOGS("\nResult: Incorrectly returned: %s", DecodeRetCode(status).c_str()); - } + PRINT_LOGS("\n\n[Led] Get Led state:"); - status = ctlOverclockGpuVoltageOffsetSet(hDAhandle, VrelOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Vrel Offset Set Correctly "); - } - else - { - PRINT_LOGS("\nResult: Incorrectly returned: %s", DecodeRetCode(status).c_str()); - } - PRINT_LOGS("\n2.1.4 Get Modified Frequency and Vrel Offset:::::::::::::::\n"); - if (ctlOverclockGpuFrequencyOffsetGet(hDAhandle, &GPUFrequencyOffset) == ctl_result_t::CTL_RESULT_SUCCESS && - ctlOverclockGpuVoltageOffsetGet(hDAhandle, &VrelOffset) == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Overclocking enabled, Frequency Offset is: %f Vrel Offset is: %f", GPUFrequencyOffset, VrelOffset); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + ctl_led_state_t ledState = { 0 }; + ledState.Size = sizeof(ctl_led_state_t); + Result = ctlLedGetState(pLedHandle[Index], &ledState); - PRINT_LOGS("\n2.1.5 Set Frequency Offset to 0 MHz and Vrel Offset to 0 v to disable OC:::::::::::::::\n"); - GPUFrequencyOffset = 0.0; // Setting Offset to 0 MHz - VrelOffset = 0.0; + if (Result != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nError: %s from Led get state.\n", DecodeRetCode(Result).c_str()); + } + else + { + PRINT_LOGS("\n[Led] Get Led State successful"); + PRINT_LOGS("\n[Led] IsOn [%u]", (uint32_t)ledState.isOn); + PRINT_LOGS("\n[Led] PWM: Led On/Off Ratio [%f]", ledState.pwm); + PRINT_LOGS("\n[Led] Red color of Led [%f]", ledState.color.red); + PRINT_LOGS("\n[Led] Green color of Led [%f]", ledState.color.green); + PRINT_LOGS("\n[Led] Blue color of Led [%f]", ledState.color.blue); + } - status = ctlOverclockGpuFrequencyOffsetSet(hDAhandle, GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Frequency Offset successfully Set to 0"); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + PRINT_LOGS("\n\n[Led] Set Led state:"); - status = ctlOverclockGpuVoltageOffsetSet(hDAhandle, VrelOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Voltage Offset successfully Set to 0"); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + void *pBuffer = &ledState; + uint32_t bufferSize = sizeof(ctl_led_state_t); + Result = ctlLedSetState(pLedHandle[Index], pBuffer, bufferSize); - PRINT_LOGS("\n2.1.6 Reading Back Frequency Offset to confirm OC is disabled:::::::::::::::\n"); - status = ctlOverclockGpuFrequencyOffsetGet(hDAhandle, &GPUFrequencyOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Overclocking disabled, Frequency Offset is:%f", GPUFrequencyOffset); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); + if (Result != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nError: %s from Led Set State\n", DecodeRetCode(Result).c_str()); + } + else + { + PRINT_LOGS("\n[Led] Successfully Set Led State\n"); + } + } } - status = ctlOverclockGpuVoltageOffsetGet(hDAhandle, &VrelOffset); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nResult: Overclocking disabled, Voltage Offset is: %f", VrelOffset); - } - else +cleanUp: + if (pLedHandle != nullptr) { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); + free(pLedHandle); + pLedHandle = nullptr; } - PRINT_LOGS("\n \n"); + return; } -/*************************************************************** - * @brief Main Function - * - * place_holder_for_Detailed_desc - * @param - * @return - ***************************************************************/ -void CtlOverclockPowerTest(ctl_device_adapter_handle_t hDAhandle) +void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) { - PRINT_LOGS("\n::::::::::::::Print Power Limit::::::::::::::\n"); - - ctl_oc_properties_t OcProperties = {}; - OcProperties.Size = sizeof(ctl_oc_properties_t); - ctl_result_t status = ctlOverclockGetProperties(hDAhandle, &OcProperties); - - if (status != ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nError Getting Properties%s", DecodeRetCode(status).c_str()); - return; - } + ctl_power_telemetry_t pPowerTelemetry = {}; + pPowerTelemetry.Size = sizeof(ctl_power_telemetry_t); + pPowerTelemetry.Version = 1; - PRINT_LOGS("\nGetting current Power Limit\n"); - double CurrentPowerLimit = 0.0; + ctl_result_t Status = ctlPowerTelemetryGet(hDAhandle, &pPowerTelemetry); - status = ctlOverclockPowerLimitGet(hDAhandle, &CurrentPowerLimit); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) + if (Status == ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nCurrent Sustained Power Limit: %f", CurrentPowerLimit); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + PRINT_LOGS("\nTelemetry Success\n \n"); - PRINT_LOGS("\n\nSetting current Power Limit outside limits:"); - - // Convert to mW and get min -1 W to be out of bounds - CurrentPowerLimit = OcProperties.powerLimit.min * 1000.0 - 1000.0; + if (pPowerTelemetry.timeStamp.bSupported) + { + PRINT_LOGS("\nTimeStamp: %f (%s) Datatype:(%s)", pPowerTelemetry.timeStamp.value.datadouble, printUnits(pPowerTelemetry.timeStamp.units).c_str(), + printType(pPowerTelemetry.timeStamp.type).c_str()); + } - status = ctlOverclockPowerLimitSet(hDAhandle, CurrentPowerLimit); - if (status == ctl_result_t::CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE) - { - PRINT_LOGS("\nCorrectly returned out of bounds."); - } + if (pPowerTelemetry.gpuEnergyCounter.bSupported) + { + PRINT_LOGS("\nGpu Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.gpuEnergyCounter.units).c_str(), + printType(pPowerTelemetry.gpuEnergyCounter.type).c_str()); + } - PRINT_LOGS("\n\nSetting current Power Limit inside limits:\n"); - // Convert to mW and get min + 1 W to be in bounds. - CurrentPowerLimit = OcProperties.powerLimit.min * 1000.0 + 1000.0; + if (pPowerTelemetry.vramEnergyCounter.bSupported) + { + PRINT_LOGS("\nVRAM Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.vramEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.vramEnergyCounter.units).c_str(), + printType(pPowerTelemetry.vramEnergyCounter.type).c_str()); + } - status = ctlOverclockPowerLimitSet(hDAhandle, CurrentPowerLimit); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nPower Limit set correctly."); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + if (pPowerTelemetry.totalCardEnergyCounter.bSupported) + { + PRINT_LOGS("\nCard Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.totalCardEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.totalCardEnergyCounter.units).c_str(), + printType(pPowerTelemetry.totalCardEnergyCounter.type).c_str()); + } - PRINT_LOGS("\n\nGetting the now current Power Limit:\n"); + if (pPowerTelemetry.gpuVoltage.bSupported) + { + PRINT_LOGS("\nGpu Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVoltage.value.datadouble, printUnits(pPowerTelemetry.gpuVoltage.units).c_str(), + printType(pPowerTelemetry.gpuVoltage.type).c_str()); + } - double NewCurrentPowerLimit = 0.0; + if (pPowerTelemetry.gpuCurrentClockFrequency.bSupported) + { + PRINT_LOGS("\nGpu Current Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentClockFrequency.value.datadouble, printUnits(pPowerTelemetry.gpuCurrentClockFrequency.units).c_str(), + printType(pPowerTelemetry.gpuCurrentClockFrequency.type).c_str()); + } - status = ctlOverclockPowerLimitGet(hDAhandle, &NewCurrentPowerLimit); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nCurrent Sustained Power Limit: %f", NewCurrentPowerLimit); - PRINT_LOGS("\nRequested Sustained Power Limit: %f", CurrentPowerLimit); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + if (pPowerTelemetry.gpuCurrentTemperature.bSupported) + { + PRINT_LOGS("\nGpu Current Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentTemperature.value.datadouble, printUnits(pPowerTelemetry.gpuCurrentTemperature.units).c_str(), + printType(pPowerTelemetry.gpuCurrentTemperature.type).c_str()); + } - PRINT_LOGS("\n \n"); -} + if (pPowerTelemetry.globalActivityCounter.bSupported) + { + PRINT_LOGS("\nGpu Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.globalActivityCounter.value.datadouble, printUnits(pPowerTelemetry.globalActivityCounter.units).c_str(), + printType(pPowerTelemetry.globalActivityCounter.type).c_str()); + } -/*************************************************************** - * @brief Main Function - * - * place_holder_for_Detailed_desc - * @param - * @return - ***************************************************************/ -void CtlOverclockTemperatureTest(ctl_device_adapter_handle_t hDAhandle) -{ - PRINT_LOGS("\n::::::::::::::Print Temperature Limit::::::::::::::\n"); + if (pPowerTelemetry.renderComputeActivityCounter.bSupported) + { + PRINT_LOGS("\nRender Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.renderComputeActivityCounter.value.datadouble, + printUnits(pPowerTelemetry.renderComputeActivityCounter.units).c_str(), printType(pPowerTelemetry.renderComputeActivityCounter.type).c_str()); + } - ctl_oc_properties_t OcProperties = {}; - OcProperties.Size = sizeof(ctl_oc_properties_t); - ctl_result_t status = ctlOverclockGetProperties(hDAhandle, &OcProperties); + if (pPowerTelemetry.mediaActivityCounter.bSupported) + { + PRINT_LOGS("\nMedia Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.mediaActivityCounter.value.datadouble, printUnits(pPowerTelemetry.mediaActivityCounter.units).c_str(), + printType(pPowerTelemetry.mediaActivityCounter.type).c_str()); + } - if (status != ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nError Getting Properties %s", DecodeRetCode(status).c_str()); - return; - } + if (pPowerTelemetry.vramVoltage.bSupported) + { + PRINT_LOGS("\nVRAM Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVoltage.value.datadouble, printUnits(pPowerTelemetry.vramVoltage.units).c_str(), + printType(pPowerTelemetry.vramVoltage.type).c_str()); + } - PRINT_LOGS("\nGetting current Temperature Limit \n"); - double CurrentTemperatureLimit = 0.0; + if (pPowerTelemetry.vramCurrentClockFrequency.bSupported) + { + PRINT_LOGS("\nVRAM Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentClockFrequency.value.datadouble, printUnits(pPowerTelemetry.vramCurrentClockFrequency.units).c_str(), + printType(pPowerTelemetry.vramCurrentClockFrequency.type).c_str()); + } - status = ctlOverclockTemperatureLimitGet(hDAhandle, &CurrentTemperatureLimit); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nCurrent Temperature Limit: %f", CurrentTemperatureLimit); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + if (pPowerTelemetry.vramReadBandwidthCounter.bSupported) + { + PRINT_LOGS("\nVRAM Read Bandwidth Counter: %llu (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidthCounter.value.datau64, + printUnits(pPowerTelemetry.vramReadBandwidthCounter.units).c_str(), printType(pPowerTelemetry.vramReadBandwidthCounter.type).c_str()); + } - PRINT_LOGS("\n\nSetting current Temperature Limit outside limits: \n"); + if (pPowerTelemetry.vramWriteBandwidthCounter.bSupported) + { + PRINT_LOGS("\nVRAM Write Bandwidth Counter: %llu (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidthCounter.value.datau64, + printUnits(pPowerTelemetry.vramWriteBandwidthCounter.units).c_str(), printType(pPowerTelemetry.vramWriteBandwidthCounter.type).c_str()); + } - CurrentTemperatureLimit = OcProperties.temperatureLimit.min - 1.0; + if (pPowerTelemetry.vramCurrentEffectiveFrequency.bSupported) + { + PRINT_LOGS("\nVRAM Effective Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentEffectiveFrequency.value.datadouble, + printUnits(pPowerTelemetry.vramCurrentEffectiveFrequency.units).c_str(), printType(pPowerTelemetry.vramCurrentEffectiveFrequency.type).c_str()); + } - status = ctlOverclockTemperatureLimitSet(hDAhandle, CurrentTemperatureLimit); - if (status == ctl_result_t::CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE) - { - PRINT_LOGS("\nCorrectly returned out of bounds."); - } + if (pPowerTelemetry.vramCurrentTemperature.bSupported) + { + PRINT_LOGS("\nVRAM Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentTemperature.value.datadouble, printUnits(pPowerTelemetry.vramCurrentTemperature.units).c_str(), + printType(pPowerTelemetry.vramCurrentTemperature.type).c_str()); + } - PRINT_LOGS("\n\nSetting current Temperature Limit inside limits: \n"); + if (pPowerTelemetry.vramReadBandwidth.bSupported) + { + PRINT_LOGS("\nVRAM Read Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidth.value.datadouble, printUnits(pPowerTelemetry.vramReadBandwidth.units).c_str(), + printType(pPowerTelemetry.vramReadBandwidth.type).c_str()); + } - CurrentTemperatureLimit = OcProperties.temperatureLimit.min + 1.0; + if (pPowerTelemetry.vramWriteBandwidth.bSupported) + { + PRINT_LOGS("\nVRAM Write Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidth.value.datadouble, printUnits(pPowerTelemetry.vramWriteBandwidth.units).c_str(), + printType(pPowerTelemetry.vramWriteBandwidth.type).c_str()); + } - status = ctlOverclockTemperatureLimitSet(hDAhandle, CurrentTemperatureLimit); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nTemperature Limit set correctly."); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + if (pPowerTelemetry.gpuVrTemp.bSupported) + { + PRINT_LOGS("\nGPU VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVrTemp.value.datadouble, printUnits(pPowerTelemetry.gpuVrTemp.units).c_str(), + printType(pPowerTelemetry.gpuVrTemp.type).c_str()); + } - PRINT_LOGS("\n\nGetting the now current Temperature Limit: \n"); + if (pPowerTelemetry.vramVrTemp.bSupported) + { + PRINT_LOGS("\nVRAM VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVrTemp.value.datadouble, printUnits(pPowerTelemetry.vramVrTemp.units).c_str(), + printType(pPowerTelemetry.vramVrTemp.type).c_str()); + } - double NewCurrentTemperatureLimit = 0.0; + if (pPowerTelemetry.saVrTemp.bSupported) + { + PRINT_LOGS("\nSA VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.saVrTemp.value.datadouble, printUnits(pPowerTelemetry.saVrTemp.units).c_str(), + printType(pPowerTelemetry.saVrTemp.type).c_str()); + } - status = ctlOverclockTemperatureLimitGet(hDAhandle, &NewCurrentTemperatureLimit); - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nCurrent Temperature Limit: %f", NewCurrentTemperatureLimit); - PRINT_LOGS("\nRequested Temperature Limit: %f", CurrentTemperatureLimit); - } - else - { - PRINT_LOGS("\nResult: Error %s", DecodeRetCode(status).c_str()); - } + if (pPowerTelemetry.gpuEffectiveClock.bSupported) + { + PRINT_LOGS("\nEffective frequency of the GPU: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEffectiveClock.value.datadouble, printUnits(pPowerTelemetry.gpuEffectiveClock.units).c_str(), + printType(pPowerTelemetry.gpuEffectiveClock.type).c_str()); + } - PRINT_LOGS("\n \n"); -} + if (pPowerTelemetry.gpuOverVoltagePercent.bSupported) + { + PRINT_LOGS("\nGPU Overvoltage Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuOverVoltagePercent.value.datadouble, printUnits(pPowerTelemetry.gpuOverVoltagePercent.units).c_str(), + printType(pPowerTelemetry.gpuOverVoltagePercent.type).c_str()); + } -/*************************************************************** - * @brief Main Function - * - * place_holder_for_Detailed_desc - * @param - * @return - ***************************************************************/ -void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) -{ - PRINT_LOGS("\n:: :: :: :: :: :: ::Print Telemetry:: :: :: :: :: :: ::\n"); + if (pPowerTelemetry.gpuPowerPercent.bSupported) + { + PRINT_LOGS("\nGPU Power Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuPowerPercent.value.datadouble, printUnits(pPowerTelemetry.gpuPowerPercent.units).c_str(), + printType(pPowerTelemetry.gpuPowerPercent.type).c_str()); + } - ctl_power_telemetry_t pPowerTelemetry = {}; - pPowerTelemetry.Size = sizeof(ctl_power_telemetry_t); - ctl_result_t status = ctlPowerTelemetryGet(hDAhandle, &pPowerTelemetry); + if (pPowerTelemetry.gpuTemperaturePercent.bSupported) + { + PRINT_LOGS("\nGPU Temperature Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuTemperaturePercent.value.datadouble, printUnits(pPowerTelemetry.gpuTemperaturePercent.units).c_str(), + printType(pPowerTelemetry.gpuTemperaturePercent.type).c_str()); + } - if (status == ctl_result_t::CTL_RESULT_SUCCESS) - { - PRINT_LOGS("\nTelemetry Success \n"); - - PRINT_LOGS("\nTimeStamp:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.timeStamp.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.timeStamp.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.timeStamp.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.timeStamp.value.datadouble); - - PRINT_LOGS("\nGpu Energy Counter:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.gpuEnergyCounter.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.gpuEnergyCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.gpuEnergyCounter.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.gpuEnergyCounter.value.datadouble); - - PRINT_LOGS("\nGpu Voltage:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.gpuVoltage.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.gpuVoltage.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.gpuVoltage.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.gpuVoltage.value.datadouble); - - PRINT_LOGS("\nGpu Current Frequency:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.gpuCurrentClockFrequency.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.gpuCurrentClockFrequency.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.gpuCurrentClockFrequency.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.gpuCurrentClockFrequency.value.datadouble); - - PRINT_LOGS("\nGpu Current Temperature:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.gpuCurrentTemperature.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.gpuCurrentTemperature.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.gpuCurrentTemperature.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.gpuCurrentTemperature.value.datadouble); - - PRINT_LOGS("\nGpu Activity Counter:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.globalActivityCounter.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.globalActivityCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.globalActivityCounter.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.globalActivityCounter.value.datadouble); - - PRINT_LOGS("\nRender Activity Counter:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.renderComputeActivityCounter.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.renderComputeActivityCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.renderComputeActivityCounter.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.renderComputeActivityCounter.value.datadouble); - - PRINT_LOGS("\nMedia Activity Counter:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.mediaActivityCounter.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.mediaActivityCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.mediaActivityCounter.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.mediaActivityCounter.value.datadouble); - - PRINT_LOGS("\nVRAM Energy Counter:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramEnergyCounter.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramEnergyCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramEnergyCounter.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramEnergyCounter.value.datadouble); - - PRINT_LOGS("\nVRAM Voltage:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramVoltage.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramVoltage.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramVoltage.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramVoltage.value.datadouble); - - PRINT_LOGS("\nVRAM Frequency:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramCurrentClockFrequency.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramCurrentClockFrequency.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentClockFrequency.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramCurrentClockFrequency.value.datadouble); - - PRINT_LOGS("\nVRAM Effective Frequency:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramCurrentEffectiveFrequency.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramCurrentEffectiveFrequency.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentEffectiveFrequency.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramCurrentEffectiveFrequency.value.datadouble); - - PRINT_LOGS("\nVRAM Read Bandwidth Counter:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramReadBandwidthCounter.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramReadBandwidthCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramReadBandwidthCounter.type)); - PRINT_LOGS("\nValue: %llu", pPowerTelemetry.vramReadBandwidthCounter.value.datau64); - - PRINT_LOGS("\nVRAM Write Bandwidth Counter:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramWriteBandwidthCounter.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramWriteBandwidthCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramWriteBandwidthCounter.type)); - PRINT_LOGS("\nValue: %llu", pPowerTelemetry.vramWriteBandwidthCounter.value.datau64); - - PRINT_LOGS("\nVRAM Temperature:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.vramCurrentTemperature.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.vramCurrentTemperature.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.vramCurrentTemperature.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.vramCurrentTemperature.value.datadouble); - - PRINT_LOGS("\nTotal Card Energy Counter:"); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.totalCardEnergyCounter.bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.totalCardEnergyCounter.units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.totalCardEnergyCounter.type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.totalCardEnergyCounter.value.datadouble); + for (int i = 0; i < CTL_FAN_COUNT; i++) + { + if (pPowerTelemetry.fanSpeed[i].bSupported) + { + PRINT_LOGS("\nFan[%d] Speed: %f (%s) Datatype:(%s)", i, pPowerTelemetry.fanSpeed[i].value.datadouble, printUnits(pPowerTelemetry.fanSpeed[i].units).c_str(), + printType(pPowerTelemetry.fanSpeed[i].type).c_str()); + } + } PRINT_LOGS("\ngpuPowerLimited: %s", ((pPowerTelemetry.gpuPowerLimited) ? "true" : "false")); PRINT_LOGS("\ngpuTemperatureLimited: %s", ((pPowerTelemetry.gpuTemperatureLimited) ? "true" : "false")); PRINT_LOGS("\ngpuCurrentLimited: %s", ((pPowerTelemetry.gpuCurrentLimited) ? "true" : "false")); PRINT_LOGS("\ngpuVoltageLimited: %s", ((pPowerTelemetry.gpuVoltageLimited) ? "true" : "false")); PRINT_LOGS("\ngpuUtilizationLimited: %s", ((pPowerTelemetry.gpuUtilizationLimited) ? "true" : "false")); - - PRINT_LOGS("\nFan Speeds:"); - for (uint32_t i = 0; i < CTL_FAN_COUNT; i++) - { - if (pPowerTelemetry.fanSpeed[i].bSupported) - { - PRINT_LOGS("\nFan %d:", i); - PRINT_LOGS("\nSupported: %s", ((pPowerTelemetry.fanSpeed[i].bSupported) ? "true" : "false")); - PRINT_LOGS("\nUnits: %s", printUnits(pPowerTelemetry.fanSpeed[i].units)); - PRINT_LOGS("\nType: %s", printType(pPowerTelemetry.fanSpeed[i].type)); - PRINT_LOGS("\nValue: %f", pPowerTelemetry.fanSpeed[i].value.datadouble); - } - } } else { - PRINT_LOGS("\nError: %s", DecodeRetCode(status).c_str()); + PRINT_LOGS("\nCtlPowerTelemetryTest => ctlPowerTelemetryGet Result Error: %s, ErrorCode: 0x%x \n \n", DecodeRetCode(Status).c_str(), Status); } - - PRINT_LOGS("\n \n"); } void PerComponentTest(ctl_device_adapter_handle_t hDAhandle) @@ -1617,6 +1211,14 @@ void PerComponentTest(ctl_device_adapter_handle_t hDAhandle) { printf("%s \n", e.what()); } + try + { + CtlLedTest(hDAhandle); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } /*************************************************************** @@ -1720,11 +1322,7 @@ int main() if (CTL_DEVICE_TYPE_GRAPHICS != StDeviceAdapterProperties.device_type) { printf("This is not a Graphics device \n"); - - if (NULL != StDeviceAdapterProperties.pDeviceID) - { - free(StDeviceAdapterProperties.pDeviceID); - } + CTL_FREE_MEM(StDeviceAdapterProperties.pDeviceID); continue; } @@ -1747,29 +1345,6 @@ int main() // Per Component Tests PerComponentTest(hDevices[Index]); - // Overclocking Test - CtlOverclockPropertiesTest(hDevices[Index]); - - std::vector vFrequencies; - vFrequencies.push_back(10.0); - vFrequencies.push_back(30.0); - vFrequencies.push_back(50.0); - vFrequencies.push_back(75.0); - vFrequencies.push_back(100.0); - vFrequencies.push_back(150.0); - vFrequencies.push_back(200.0); - vFrequencies.push_back(250.0); - - for (uint32_t ci = 0; ci < vFrequencies.size(); ci++) - { - CtlOverclockFrequencyOffsetTest(hDevices[Index], vFrequencies[ci]); - } - - CtlOverclockFrequencyAndVoltageOffsetTest(hDevices[Index]); - - CtlOverclockPowerTest(hDevices[Index]); - CtlOverclockTemperatureTest(hDevices[Index]); - // Telemetry Test // Polling during 1 second at 20 ms for (uint32_t i = 0; i < 50; i++) @@ -1785,10 +1360,7 @@ int main() Sleep(20); } - if (NULL != StDeviceAdapterProperties.pDeviceID) - { - free(StDeviceAdapterProperties.pDeviceID); - } + CTL_FREE_MEM(StDeviceAdapterProperties.pDeviceID); } } } @@ -1796,130 +1368,7 @@ int main() Exit: ctlClose(hAPIHandle); - - if (hDevices != nullptr) - { - free(hDevices); - hDevices = nullptr; - } + CTL_FREE_MEM(hDevices); return 0; -} - -// Decoding the return code for the most common error codes. -std::string DecodeRetCode(ctl_result_t Res) -{ - switch (Res) - { - case CTL_RESULT_SUCCESS: - { - return std::string("[CTL_RESULT_SUCCESS]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_NOT_SUPPORTED]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_VOLTAGE_OUTSIDE_RANGE]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_FREQUENCY_OUTSIDE_RANGE]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_POWER_OUTSIDE_RANGE]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_TEMPERATURE_OUTSIDE_RANGE]"); - } - case CTL_RESULT_ERROR_GENERIC_START: - { - return std::string("[CTL_RESULT_ERROR_GENERIC_START]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_RESET_REQUIRED]"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_IN_VOLTAGE_LOCKED_MODE"); - } - case CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET: - { - return std::string("[CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET]"); - } - case CTL_RESULT_ERROR_NOT_INITIALIZED: - { - return std::string("[CTL_RESULT_ERROR_NOT_INITIALIZED]"); - } - case CTL_RESULT_ERROR_ALREADY_INITIALIZED: - { - return std::string("[CTL_RESULT_ERROR_ALREADY_INITIALIZED]"); - } - case CTL_RESULT_ERROR_DEVICE_LOST: - { - return std::string("[CTL_RESULT_ERROR_DEVICE_LOST]"); - } - case CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS: - { - return std::string("[CTL_RESULT_ERROR_INSUFFICIENT_PERMISSIONS]"); - } - case CTL_RESULT_ERROR_NOT_AVAILABLE: - { - return std::string("[CTL_RESULT_ERROR_NOT_AVAILABLE]"); - } - case CTL_RESULT_ERROR_UNINITIALIZED: - { - return std::string("[CTL_RESULT_ERROR_UNINITIALIZED]"); - } - case CTL_RESULT_ERROR_UNSUPPORTED_VERSION: - { - return std::string("[CTL_RESULT_ERROR_UNSUPPORTED_VERSION]"); - } - case CTL_RESULT_ERROR_UNSUPPORTED_FEATURE: - { - return std::string("[CTL_RESULT_ERROR_UNSUPPORTED_FEATURE]"); - } - case CTL_RESULT_ERROR_INVALID_ARGUMENT: - { - return std::string("[CTL_RESULT_ERROR_INVALID_ARGUMENT]"); - } - case CTL_RESULT_ERROR_INVALID_NULL_HANDLE: - { - return std::string("[CTL_RESULT_ERROR_INVALID_NULL_HANDLE]"); - } - case CTL_RESULT_ERROR_INVALID_NULL_POINTER: - { - return std::string("[CTL_RESULT_ERROR_INVALID_NULL_POINTER]"); - } - case CTL_RESULT_ERROR_INVALID_SIZE: - { - return std::string("[CTL_RESULT_ERROR_INVALID_SIZE]"); - } - case CTL_RESULT_ERROR_UNSUPPORTED_SIZE: - { - return std::string("[CTL_RESULT_ERROR_UNSUPPORTED_SIZE]"); - } - case CTL_RESULT_ERROR_NOT_IMPLEMENTED: - { - return std::string("[CTL_RESULT_ERROR_NOT_IMPLEMENTED]"); - } - case CTL_RESULT_ERROR_ZE_LOADER: - { - return std::string("[CTL_RESULT_ERROR_ZE_LOADER]"); - } - case CTL_RESULT_ERROR_INVALID_OPERATION_TYPE: - { - return std::string("[CTL_RESULT_ERROR_INVALID_OPERATION_TYPE]"); - } - case CTL_RESULT_ERROR_UNKNOWN: - { - return std::string("[CTL_RESULT_ERROR_UNKNOWN]"); - } - default: - return std::string("[Unknown Error]"); - } -} +} \ No newline at end of file diff --git a/Samples/UBRR_Sample/UBRR_Sample_App.cpp b/Samples/UBRR_Sample/UBRR_Sample_App.cpp index f8a1d90..7f44ae6 100644 --- a/Samples/UBRR_Sample/UBRR_Sample_App.cpp +++ b/Samples/UBRR_Sample/UBRR_Sample_App.cpp @@ -40,7 +40,7 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput if (0 == DisplayCount) { - printf("Invalid Display Count \n"); + APP_LOG_ERROR("Invalid Display Count "); goto Exit; } @@ -115,13 +115,13 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } else if (DisplayCount <= 0) { - printf("Invalid Display Count. skipping display enumration for adapter:%d\n", AdapterIndex); + APP_LOG_WARN("Invalid Display Count. skipping display enumeration for adapter:%d", AdapterIndex); continue; } @@ -177,7 +177,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -189,7 +189,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -202,14 +202,14 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } Result = EnumerateTargetDisplays(AdapterCount, hDevices); if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateTargetDisplays returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateTargetDisplays returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -217,6 +217,6 @@ int main() ctlClose(hAPIHandle); CTL_FREE_MEM(hDevices); - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } \ No newline at end of file diff --git a/Samples/inc/GenericIGCLApp.h b/Samples/inc/GenericIGCLApp.h index 3959326..5635966 100644 --- a/Samples/inc/GenericIGCLApp.h +++ b/Samples/inc/GenericIGCLApp.h @@ -38,29 +38,36 @@ if (CTL_RESULT_SUCCESS != Result) \ goto Exit; -#define LOG_AND_EXIT_ON_ERROR(Result, ErrRtrndByFunc) \ - if (CTL_RESULT_SUCCESS != Result) \ - { \ - printf("%s returned failure code: 0x%X\n", ErrRtrndByFunc, Result); \ - goto Exit; \ +#define LOG_AND_EXIT_ON_ERROR(Result, ErrRtrndByFunc) \ + if (CTL_RESULT_SUCCESS != Result) \ + { \ + printf("[ERROR] %s returned failure code: 0x%X\n", ErrRtrndByFunc, Result); \ + goto Exit; \ } -#define EXIT_ON_MEM_ALLOC_FAILURE(Ptr, AllocatedVarName) \ - if (NULL == Ptr) \ - { \ - Result = CTL_RESULT_ERROR_INVALID_NULL_POINTER; \ - printf("Memory Allocation Failed: %s \n", AllocatedVarName); \ - goto Exit; \ +#define EXIT_ON_MEM_ALLOC_FAILURE(Ptr, AllocatedVarName) \ + if (NULL == Ptr) \ + { \ + Result = CTL_RESULT_ERROR_INVALID_NULL_POINTER; \ + printf("[ERROR] Memory Allocation Failed: %s \n", AllocatedVarName); \ + goto Exit; \ } -#define LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, ErrRtrndByFunc) \ - if (CTL_RESULT_SUCCESS != Result) \ - { \ - printf("%s returned failure code: 0x%X\n", ErrRtrndByFunc, Result); \ - STORE_AND_RESET_ERROR(Result); \ +#define LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, ErrRtrndByFunc) \ + if (CTL_RESULT_SUCCESS != Result) \ + { \ + printf("[ERROR] %s returned failure code: 0x%X\n", ErrRtrndByFunc, Result); \ + STORE_AND_RESET_ERROR(Result); \ } -#define PRINT_LOGS(...) printf(__VA_ARGS__) +// Application logging macro +#define APP_LOG_INFO(fmt, ...) printf("[INFO] " fmt "\n", ##__VA_ARGS__) +#define APP_LOG_WARN(fmt, ...) printf("[WARN] " fmt "\n", ##__VA_ARGS__) +#define APP_LOG_ERROR(fmt, ...) printf("[ERROR] " fmt "\n", ##__VA_ARGS__) + +#define PRINT_LOGS(...) \ + printf(__VA_ARGS__); \ + printf("\n") #define CONTROL_BIT(_i) (1 << _i) @@ -174,19 +181,19 @@ inline void Print3DFeatureSupport(ctl_3d_feature_details_t *pFeatureDetails) FeatureSupport = pFeatureDetails->FeatureMiscSupport; if (CTL_3D_FEATURE_MISC_FLAG_DX11 & FeatureSupport) { - printf(" pFeatureDetails->FeatureMiscSupport = CTL_3D_FEATURE_MISC_FLAG_DX11\n"); + printf("[INFO] pFeatureDetails->FeatureMiscSupport = CTL_3D_FEATURE_MISC_FLAG_DX11\n"); } if (CTL_3D_FEATURE_MISC_FLAG_DX12 & FeatureSupport) { - printf(" pFeatureDetails->FeatureMiscSupport = CTL_3D_FEATURE_MISC_FLAG_DX12\n"); + printf("[INFO] pFeatureDetails->FeatureMiscSupport = CTL_3D_FEATURE_MISC_FLAG_DX12\n"); } if (CTL_3D_FEATURE_MISC_FLAG_VULKAN & FeatureSupport) { - printf(" pFeatureDetails->FeatureMiscSupport = CTL_3D_FEATURE_MISC_FLAG_VULKAN\n"); + printf("[INFO] pFeatureDetails->FeatureMiscSupport = CTL_3D_FEATURE_MISC_FLAG_VULKAN\n"); } if (CTL_3D_FEATURE_MISC_FLAG_LIVE_CHANGE & FeatureSupport) { - printf(" pFeatureDetails->FeatureMiscSupport = CTL_3D_FEATURE_MISC_FLAG_LIVE_CHANGE\n"); + printf("[INFO] pFeatureDetails->FeatureMiscSupport = CTL_3D_FEATURE_MISC_FLAG_LIVE_CHANGE\n"); } return; } @@ -202,17 +209,17 @@ inline void PrintEnduranceGamingControl(uint32_t Control) switch (Control) { case CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_OFF: - printf(" pEGCaps->EGControlCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_OFF\n"); + printf("[INFO] pEGCaps->EGControlCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_OFF\n"); break; case CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_ON: - printf(" pEGCaps->EGControlCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_ON\n"); + printf("[INFO] pEGCaps->EGControlCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_ON\n"); break; case CTL_3D_ENDURANCE_GAMING_CONTROL_AUTO: - printf(" pEGCaps->EGControlCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_CONTROL_AUTO\n"); + printf("[INFO] pEGCaps->EGControlCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_CONTROL_AUTO\n"); break; @@ -232,17 +239,17 @@ inline void PrintEnduranceGamingMode(uint32_t Mode) switch (Mode) { case CTL_3D_ENDURANCE_GAMING_MODE_BETTER_PERFORMANCE: - printf(" pEGCaps->EGModeCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_MODE_BETTER_PERFORMANCE\n"); + printf("[INFO] pEGCaps->EGModeCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_MODE_BETTER_PERFORMANCE\n"); break; case CTL_3D_ENDURANCE_GAMING_MODE_BALANCED: - printf(" pEGCaps->EGModeCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_MODE_BALANCED\n"); + printf("[INFO] pEGCaps->EGModeCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_MODE_BALANCED\n"); break; case CTL_3D_ENDURANCE_GAMING_MODE_MAXIMUM_BATTERY: - printf(" pEGCaps->EGModeCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_MODE_MAXIMUM_BATTERY\n"); + printf("[INFO] pEGCaps->EGModeCaps.SupportedTypes = CTL_3D_ENDURANCE_GAMING_MODE_MAXIMUM_BATTERY\n"); break; @@ -311,44 +318,44 @@ inline void Print3DFeatureDetail(ctl_3d_feature_details_t *pFeatureDetails) { if (pFeatureDetails) { - printf("3D Feature supported: %s (%d)\n", Get3DFeatureName(pFeatureDetails->FeatureType), pFeatureDetails->FeatureType); - printf(" Feature conflict mask flag: 0x%llX\n", pFeatureDetails->ConflictingFeatures); - printf(" Supported per application: %d\n", pFeatureDetails->PerAppSupport); - printf(" Supports live change: %s\n", (pFeatureDetails->FeatureMiscSupport & CTL_3D_FEATURE_MISC_FLAG_LIVE_CHANGE) ? "Yes" : "No"); + printf("[INFO] 3D Feature supported: %s (%d)\n", Get3DFeatureName(pFeatureDetails->FeatureType), pFeatureDetails->FeatureType); + printf("[INFO] Feature conflict mask flag: 0x%llX\n", pFeatureDetails->ConflictingFeatures); + printf("[INFO] Supported per application: %d\n", pFeatureDetails->PerAppSupport); + printf("[INFO] Supports live change: %s\n", (pFeatureDetails->FeatureMiscSupport & CTL_3D_FEATURE_MISC_FLAG_LIVE_CHANGE) ? "Yes" : "No"); Print3DFeatureSupport(pFeatureDetails); switch (pFeatureDetails->ValueType) { case CTL_PROPERTY_VALUE_TYPE_ENUM: { - printf(" Default value: %d\n", pFeatureDetails->Value.EnumType.DefaultType); + printf("[INFO] Default value: %d\n", pFeatureDetails->Value.EnumType.DefaultType); if (CTL_3D_FEATURE_GAMING_FLIP_MODES == pFeatureDetails->FeatureType) { ctl_gaming_flip_mode_flags_t GamingflipCaps = (ctl_gaming_flip_mode_flags_t)pFeatureDetails->Value.EnumType.SupportedTypes; if (CTL_GAMING_FLIP_MODE_FLAG_APPLICATION_DEFAULT & GamingflipCaps) { - printf(" pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_APPLICATION_DEFAULT\n"); + printf("[INFO] pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_APPLICATION_DEFAULT\n"); } if (CTL_GAMING_FLIP_MODE_FLAG_VSYNC_OFF & GamingflipCaps) { - printf(" pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_VSYNC_OFF\n"); + printf("[INFO] pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_VSYNC_OFF\n"); } if (CTL_GAMING_FLIP_MODE_FLAG_VSYNC_ON & GamingflipCaps) { - printf(" pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_VSYNC_ON\n"); + printf("[INFO] pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_VSYNC_ON\n"); } if (CTL_GAMING_FLIP_MODE_FLAG_SMOOTH_SYNC & GamingflipCaps) { - printf(" pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_SMOOTH_SYNC\n"); + printf("[INFO] pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_SMOOTH_SYNC\n"); } if (CTL_GAMING_FLIP_MODE_FLAG_SPEED_FRAME & GamingflipCaps) { - printf(" pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_SPEED_FRAME\n"); + printf("[INFO] pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_SPEED_FRAME\n"); } if (CTL_GAMING_FLIP_MODE_FLAG_CAPPED_FPS & GamingflipCaps) { - printf(" pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_CAPPED_FPS\n"); + printf("[INFO] pFeatureDetails->Value.EnumType.SupportedTypes = CTL_GAMING_FLIP_MODE_FLAG_CAPPED_FPS\n"); } } // printf(" Enabled value: %d\n", pFeatureDetails->Value.EnumType.EnableType); @@ -356,25 +363,25 @@ inline void Print3DFeatureDetail(ctl_3d_feature_details_t *pFeatureDetails) break; case CTL_PROPERTY_VALUE_TYPE_BOOL: { - printf(" Default value: %d\n", pFeatureDetails->Value.BoolType.DefaultState); + printf("[INFO] Default value: %d\n", pFeatureDetails->Value.BoolType.DefaultState); // printf(" Enabled value: %d\n", pFeatureDetails->Value.BoolType.Enable); } break; case CTL_PROPERTY_VALUE_TYPE_FLOAT: { - printf(" Min possible value: %f\n", pFeatureDetails->Value.FloatType.RangeInfo.min_possible_value); - printf(" Max possible value: %f\n", pFeatureDetails->Value.FloatType.RangeInfo.max_possible_value); - printf(" Step size: %f\n", pFeatureDetails->Value.FloatType.RangeInfo.step_size); - printf(" Default value: %f\n", pFeatureDetails->Value.FloatType.RangeInfo.default_value); + printf("[INFO] Min possible value: %f\n", pFeatureDetails->Value.FloatType.RangeInfo.min_possible_value); + printf("[INFO] Max possible value: %f\n", pFeatureDetails->Value.FloatType.RangeInfo.max_possible_value); + printf("[INFO] Step size: %f\n", pFeatureDetails->Value.FloatType.RangeInfo.step_size); + printf("[INFO] Default value: %f\n", pFeatureDetails->Value.FloatType.RangeInfo.default_value); // printf(" Current value: %f\n", pFeatureDetails->Value.FloatType.Value); } break; case CTL_PROPERTY_VALUE_TYPE_INT32: { - printf(" Min possible value: %d\n", pFeatureDetails->Value.IntType.RangeInfo.min_possible_value); - printf(" Max possible value: %d\n", pFeatureDetails->Value.IntType.RangeInfo.max_possible_value); - printf(" Step size: %d\n", pFeatureDetails->Value.IntType.RangeInfo.step_size); - printf(" Default value: %d\n", pFeatureDetails->Value.IntType.RangeInfo.default_value); + printf("[INFO] Min possible value: %d\n", pFeatureDetails->Value.IntType.RangeInfo.min_possible_value); + printf("[INFO] Max possible value: %d\n", pFeatureDetails->Value.IntType.RangeInfo.max_possible_value); + printf("[INFO] Step size: %d\n", pFeatureDetails->Value.IntType.RangeInfo.step_size); + printf("[INFO] Default value: %d\n", pFeatureDetails->Value.IntType.RangeInfo.default_value); // printf(" Current value: %d\n", pFeatureDetails->Value.IntType.Value); } break; @@ -382,7 +389,7 @@ inline void Print3DFeatureDetail(ctl_3d_feature_details_t *pFeatureDetails) { if (pFeatureDetails->pCustomValue == NULL) { - printf(" Empty custom data\n"); + printf("[WARN] Empty custom data\n"); break; } @@ -391,12 +398,12 @@ inline void Print3DFeatureDetail(ctl_3d_feature_details_t *pFeatureDetails) case CTL_3D_FEATURE_ADAPTIVE_SYNC_PLUS: { ctl_adaptivesync_caps_t *pASCaps = (ctl_adaptivesync_caps_t *)pFeatureDetails->pCustomValue; - printf(" AdaptiveBalanceSupported = %d\n", pASCaps->AdaptiveBalanceSupported); - printf(" AdaptiveBalanceStrengthCaps.DefaultEnable = %d\n", pASCaps->AdaptiveBalanceStrengthCaps.DefaultEnable); - printf(" AdaptiveBalanceStrengthCaps.RangeInfo.default_value = %f\n", pASCaps->AdaptiveBalanceStrengthCaps.RangeInfo.default_value); - printf(" AdaptiveBalanceStrengthCaps.RangeInfo.min_possible_value = %f\n", pASCaps->AdaptiveBalanceStrengthCaps.RangeInfo.min_possible_value); - printf(" AdaptiveBalanceStrengthCaps.RangeInfo.max_possible_value = %f\n", pASCaps->AdaptiveBalanceStrengthCaps.RangeInfo.max_possible_value); - printf(" AdaptiveBalanceStrengthCaps.RangeInfo.step_size = %f\n", pASCaps->AdaptiveBalanceStrengthCaps.RangeInfo.step_size); + printf("[INFO] AdaptiveBalanceSupported = %d\n", pASCaps->AdaptiveBalanceSupported); + printf("[INFO] AdaptiveBalanceStrengthCaps.DefaultEnable = %d\n", pASCaps->AdaptiveBalanceStrengthCaps.DefaultEnable); + printf("[INFO] AdaptiveBalanceStrengthCaps.RangeInfo.default_value = %f\n", pASCaps->AdaptiveBalanceStrengthCaps.RangeInfo.default_value); + printf("[INFO] AdaptiveBalanceStrengthCaps.RangeInfo.min_possible_value = %f\n", pASCaps->AdaptiveBalanceStrengthCaps.RangeInfo.min_possible_value); + printf("[INFO] AdaptiveBalanceStrengthCaps.RangeInfo.max_possible_value = %f\n", pASCaps->AdaptiveBalanceStrengthCaps.RangeInfo.max_possible_value); + printf("[INFO] AdaptiveBalanceStrengthCaps.RangeInfo.step_size = %f\n", pASCaps->AdaptiveBalanceStrengthCaps.RangeInfo.step_size); } break; @@ -405,8 +412,8 @@ inline void Print3DFeatureDetail(ctl_3d_feature_details_t *pFeatureDetails) ctl_endurance_gaming_caps_t *pEGCaps = (ctl_endurance_gaming_caps_t *)pFeatureDetails->pCustomValue; std::vector EGControls = { CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_OFF, CTL_3D_ENDURANCE_GAMING_CONTROL_TURN_ON, CTL_3D_ENDURANCE_GAMING_CONTROL_AUTO }; std::vector EGModes = { CTL_3D_ENDURANCE_GAMING_MODE_BETTER_PERFORMANCE, CTL_3D_ENDURANCE_GAMING_MODE_BALANCED, CTL_3D_ENDURANCE_GAMING_MODE_MAXIMUM_BATTERY }; - printf(" pEGCaps->EGControlCaps.DefaultType = %d\n", pEGCaps->EGControlCaps.DefaultType); - printf(" pEGCaps->EGModeCaps.DefaultType = %d\n", pEGCaps->EGModeCaps.DefaultType); + printf("[INFO] pEGCaps->EGControlCaps.DefaultType = %d\n", pEGCaps->EGControlCaps.DefaultType); + printf("[INFO] pEGCaps->EGModeCaps.DefaultType = %d\n", pEGCaps->EGModeCaps.DefaultType); Print3DFeatureSupportedSettings(pEGCaps->EGControlCaps.SupportedTypes, move(EGControls), ENDURANCE_GAMING_CONTROLS); Print3DFeatureSupportedSettings(pEGCaps->EGModeCaps.SupportedTypes, move(EGModes), ENDURANCE_GAMING_MODES); @@ -416,13 +423,13 @@ inline void Print3DFeatureDetail(ctl_3d_feature_details_t *pFeatureDetails) case CTL_3D_FEATURE_APP_PROFILES: { ctl_3d_app_profiles_caps_t *pCaps = (ctl_3d_app_profiles_caps_t *)pFeatureDetails->pCustomValue; - printf(" pCaps->SupportedTierTypes = %s\n", GetProfileTypeName(pCaps->SupportedTierTypes)); + printf("[INFO] pCaps->SupportedTierTypes = %s\n", GetProfileTypeName(pCaps->SupportedTierTypes)); } break; default: { - printf(" Unknown feature type with custom capabilities! ERROR!!\n"); + printf("[ERROR] Unknown feature type with custom capabilities! ERROR!!\n"); } break; } diff --git a/Source/cApiWrapper.cpp b/Source/cApiWrapper.cpp index 6e66cdb..ab3962d 100644 --- a/Source/cApiWrapper.cpp +++ b/Source/cApiWrapper.cpp @@ -3586,6 +3586,9 @@ ctlLedGetState( * @details * - The application may call this function from simultaneous threads. * - The implementation of this function should be lock-free. +* - This API is rate-limited by 500 milliseconds, If this API is called +* too frequently ::CTL_ERROR_CORE_LED_TOO_FREQUENT_SET_REQUESTS error +* will be returned * * @returns * - CTL_RESULT_SUCCESS @@ -4725,6 +4728,626 @@ ctlOverclockResetToDefault( } +/** +* @brief Get the Current Overclock GPU Frequency Offset +* +* @details +* - Determine the current frequency offset in effect (refer to +* ::ctlOverclockGpuFrequencyOffsetSetV2() for details). +* - The unit of the value returned is given in +* ::ctl_oc_properties_t::gpuFrequencyOffset::units returned from +* ::ctlOverclockGetProperties() +* - The unit of the value returned can be different for different +* generation of graphics product +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pOcFrequencyOffset` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuFrequencyOffsetGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcFrequencyOffset ///< [in,out] Current GPU Overclock Frequency Offset in units given in + ///< ::ctl_oc_properties_t::gpuFrequencyOffset::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuFrequencyOffsetGetV2_t pfnOverclockGpuFrequencyOffsetGetV2 = (ctl_pfnOverclockGpuFrequencyOffsetGetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuFrequencyOffsetGetV2"); + if (pfnOverclockGpuFrequencyOffsetGetV2) + { + result = pfnOverclockGpuFrequencyOffsetGetV2(hDeviceHandle, pOcFrequencyOffset); + } + } + + return result; +} + + +/** +* @brief Set the Overclock Frequency Offset for the GPU +* +* @details +* - The purpose of this function is to increase/decrease the frequency +* offset at which typical workloads will run within the same thermal +* budget. +* - The frequency offset is expressed in units given in +* ::ctl_oc_properties_t::gpuFrequencyOffset::units returned from +* ::ctlOverclockGetProperties() +* - The actual operating frequency for each workload is not guaranteed to +* change exactly by the specified offset. +* - For positive frequency offsets, the factory maximum frequency may +* increase by up to the specified amount. +* - Specifying large values for the frequency offset can lead to +* instability. It is recommended that changes are made in small +* increments and stability/performance measured running intense GPU +* workloads before increasing further. +* - This setting is not persistent through system reboots or driver +* resets/hangs. It is up to the overclock application to reapply the +* settings in those cases. +* - This setting can cause system/device instability. It is up to the +* overclock application to detect if the system has rebooted +* unexpectedly or the device was restarted. When this occurs, the +* application should not reapply the overclock settings automatically +* but instead return to previously known good settings or notify the +* user that the settings are not being applied. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuFrequencyOffsetSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocFrequencyOffset ///< [in] The GPU Overclocking Frequency Offset Desired in units given in + ///< ::ctl_oc_properties_t::gpuFrequencyOffset::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuFrequencyOffsetSetV2_t pfnOverclockGpuFrequencyOffsetSetV2 = (ctl_pfnOverclockGpuFrequencyOffsetSetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuFrequencyOffsetSetV2"); + if (pfnOverclockGpuFrequencyOffsetSetV2) + { + result = pfnOverclockGpuFrequencyOffsetSetV2(hDeviceHandle, ocFrequencyOffset); + } + } + + return result; +} + + +/** +* @brief Get the Current Overclock Voltage Offset for the GPU +* +* @details +* - Determine the current maximum voltage offset in effect on the hardware +* (refer to ::ctlOverclockGpuMaxVoltageOffsetSetV2 for details). +* - The unit of the value returned is given in +* ::ctl_oc_properties_t::gpuVoltageOffset::units returned from +* ::ctlOverclockGetProperties() +* - The unit of the value returned can be different for different +* generation of graphics product +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pOcMaxVoltageOffset` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuMaxVoltageOffsetGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcMaxVoltageOffset ///< [in,out] Current Overclock GPU Voltage Offset in Units given in + ///< ::ctl_oc_properties_t::gpuVoltageOffset::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuMaxVoltageOffsetGetV2_t pfnOverclockGpuMaxVoltageOffsetGetV2 = (ctl_pfnOverclockGpuMaxVoltageOffsetGetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuMaxVoltageOffsetGetV2"); + if (pfnOverclockGpuMaxVoltageOffsetGetV2) + { + result = pfnOverclockGpuMaxVoltageOffsetGetV2(hDeviceHandle, pOcMaxVoltageOffset); + } + } + + return result; +} + + +/** +* @brief Set the Overclock Voltage Offset for the GPU +* +* @details +* - The purpose of this function is to attempt to run the GPU up to higher +* voltages beyond the part warrantee limits. This can permit running at +* even higher frequencies than can be obtained using the frequency +* offset setting, but at the risk of reducing the lifetime of the part. +* - The voltage offset is expressed in units given in +* ::ctl_oc_properties_t::gpuVoltageOffset::units returned from +* ::ctlOverclockGetProperties() +* - The overclock waiver must be set before calling this function +* otherwise error will be returned. +* - There is no guarantee that a workload can operate at the higher +* frequencies permitted by this setting. Significantly more heat will be +* generated at these high frequencies/voltages which will necessitate a +* good cooling solution. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockGpuMaxVoltageOffsetSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocMaxVoltageOffset ///< [in] The Overclocking Maximum Voltage Desired in units given in + ///< ::ctl_oc_properties_t::gpuVoltageOffset::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockGpuMaxVoltageOffsetSetV2_t pfnOverclockGpuMaxVoltageOffsetSetV2 = (ctl_pfnOverclockGpuMaxVoltageOffsetSetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockGpuMaxVoltageOffsetSetV2"); + if (pfnOverclockGpuMaxVoltageOffsetSetV2) + { + result = pfnOverclockGpuMaxVoltageOffsetSetV2(hDeviceHandle, ocMaxVoltageOffset); + } + } + + return result; +} + + +/** +* @brief Get the current Overclock Vram Memory Speed +* +* @details +* - The purpose of this function is to return the current VRAM Memory +* Speed +* - The unit of the value returned is given in +* ::ctl_oc_properties_t::vramMemSpeedLimit::units returned from +* ::ctlOverclockGetProperties() +* - The unit of the value returned can be different for different +* generation of graphics product +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pOcVramMemSpeedLimit` +*/ +ctl_result_t CTL_APICALL +ctlOverclockVramMemSpeedLimitGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcVramMemSpeedLimit ///< [in,out] The current VRAM Memory Speed in units given in + ///< ::ctl_oc_properties_t::vramMemSpeedLimit::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockVramMemSpeedLimitGetV2_t pfnOverclockVramMemSpeedLimitGetV2 = (ctl_pfnOverclockVramMemSpeedLimitGetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramMemSpeedLimitGetV2"); + if (pfnOverclockVramMemSpeedLimitGetV2) + { + result = pfnOverclockVramMemSpeedLimitGetV2(hDeviceHandle, pOcVramMemSpeedLimit); + } + } + + return result; +} + + +/** +* @brief Set the desired Overclock Vram Memory Speed +* +* @details +* - The purpose of this function is to increase/decrease the Speed of +* VRAM. +* - The Memory Speed is expressed in units given in +* ::ctl_oc_properties_t::vramMemSpeedLimit::units returned from +* ::ctlOverclockGetProperties() with a minimum step size given by +* ::ctlOverclockGetProperties(). +* - The actual Memory Speed for each workload is not guaranteed to change +* exactly by the specified offset. +* - This setting is not persistent through system reboots or driver +* resets/hangs. It is up to the overclock application to reapply the +* settings in those cases. +* - This setting can cause system/device instability. It is up to the +* overclock application to detect if the system has rebooted +* unexpectedly or the device was restarted. When this occurs, the +* application should not reapply the overclock settings automatically +* but instead return to previously known good settings or notify the +* user that the settings are not being applied. +* - If the memory controller doesn't support changes to memory speed on +* the fly, one of the following return codes will be given: +* - CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory overclock +* will be applied when the device is reset or the system is rebooted. In +* this case, the overclock software should check if the overclock +* request was applied after the reset/reboot. If it was and when the +* overclock application shuts down gracefully and if the overclock +* application wants the setting to be persistent, the application should +* request the same overclock settings again so that they will be applied +* on the next reset/reboot. If this is not done, then every time the +* device is reset and overclock is requested, the device needs to be +* reset a second time. +* - CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory overclock +* will be applied when the system is rebooted. In this case, the +* overclock software should check if the overclock request was applied +* after the reboot. If it was and when the overclock application shuts +* down gracefully and if the overclock application wants the setting to +* be persistent, the application should request the same overclock +* settings again so that they will be applied on the next reset/reboot. +* If this is not done and the overclock setting is requested after the +* reboot has occurred, a second reboot will be required. +* - CTL_RESULT_ERROR_UNSUPPORTED_FEATURE: The Memory Speed Get / Set +* Feature is currently not available or Unsupported in current platform +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockVramMemSpeedLimitSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocVramMemSpeedLimit ///< [in] The desired Memory Speed in units given in + ///< ::ctl_oc_properties_t::vramMemSpeedLimit::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockVramMemSpeedLimitSetV2_t pfnOverclockVramMemSpeedLimitSetV2 = (ctl_pfnOverclockVramMemSpeedLimitSetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockVramMemSpeedLimitSetV2"); + if (pfnOverclockVramMemSpeedLimitSetV2) + { + result = pfnOverclockVramMemSpeedLimitSetV2(hDeviceHandle, ocVramMemSpeedLimit); + } + } + + return result; +} + + +/** +* @brief Get the Current Sustained power limit +* +* @details +* - The purpose of this function is to read the current sustained power +* limit. +* - The unit of the value returned is given in +* ::ctl_oc_properties_t::powerLimit::units returned from +* ::ctlOverclockGetProperties() +* - The unit of the value returned can be different for different +* generation of graphics product +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pSustainedPowerLimit` +*/ +ctl_result_t CTL_APICALL +ctlOverclockPowerLimitGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pSustainedPowerLimit ///< [in,out] The current Sustained Power limit in Units given in + ///< ::ctl_oc_properties_t::powerLimit::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockPowerLimitGetV2_t pfnOverclockPowerLimitGetV2 = (ctl_pfnOverclockPowerLimitGetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockPowerLimitGetV2"); + if (pfnOverclockPowerLimitGetV2) + { + result = pfnOverclockPowerLimitGetV2(hDeviceHandle, pSustainedPowerLimit); + } + } + + return result; +} + + +/** +* @brief Set the Sustained power limit +* +* @details +* - The purpose of this function is to set the maximum sustained power +* limit. If the average GPU power averaged over a few seconds exceeds +* this value, the frequency of the GPU will be throttled. +* - Set a value of 0 to disable this power limit. In this case, the GPU +* frequency will not throttle due to average power but may hit other +* limits. +* - The unit of the PowerLimit to be set is given in +* ::ctl_oc_properties_t::powerLimit::units returned from +* ::ctlOverclockGetProperties() +* - The unit of the value returned can be different for different +* generation of graphics product +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockPowerLimitSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double sustainedPowerLimit ///< [in] The desired sustained power limit in Units given in + ///< ::ctl_oc_properties_t::powerLimit::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockPowerLimitSetV2_t pfnOverclockPowerLimitSetV2 = (ctl_pfnOverclockPowerLimitSetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockPowerLimitSetV2"); + if (pfnOverclockPowerLimitSetV2) + { + result = pfnOverclockPowerLimitSetV2(hDeviceHandle, sustainedPowerLimit); + } + } + + return result; +} + + +/** +* @brief Get the current temperature limit +* +* @details +* - The purpose of this function is to read the current thermal limit used +* for Overclocking +* - The unit of the value returned is given in +* ::ctl_oc_properties_t::temperatureLimit::units returned from +* ::ctlOverclockGetProperties() +* - The unit of the value returned can be different for different +* generation of graphics product +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pTemperatureLimit` +*/ +ctl_result_t CTL_APICALL +ctlOverclockTemperatureLimitGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pTemperatureLimit ///< [in,out] The current temperature limit in Units given in + ///< ::ctl_oc_properties_t::temperatureLimit::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockTemperatureLimitGetV2_t pfnOverclockTemperatureLimitGetV2 = (ctl_pfnOverclockTemperatureLimitGetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockTemperatureLimitGetV2"); + if (pfnOverclockTemperatureLimitGetV2) + { + result = pfnOverclockTemperatureLimitGetV2(hDeviceHandle, pTemperatureLimit); + } + } + + return result; +} + + +/** +* @brief Set the temperature limit +* +* @details +* - The purpose of this function is to change the maximum thermal limit. +* When the GPU temperature exceeds this value, the GPU frequency will be +* throttled. +* - The unit of the value to be set is given in +* ::ctl_oc_properties_t::temperatureLimit::units returned from +* ::ctlOverclockGetProperties() +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceHandle` +*/ +ctl_result_t CTL_APICALL +ctlOverclockTemperatureLimitSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double temperatureLimit ///< [in] The desired temperature limit in Units given in + ///< ::ctl_oc_properties_t::temperatureLimit::units returned from + ///< ::ctlOverclockGetProperties() + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockTemperatureLimitSetV2_t pfnOverclockTemperatureLimitSetV2 = (ctl_pfnOverclockTemperatureLimitSetV2_t)GetProcAddress(hinstLibPtr, "ctlOverclockTemperatureLimitSetV2"); + if (pfnOverclockTemperatureLimitSetV2) + { + result = pfnOverclockTemperatureLimitSetV2(hDeviceHandle, temperatureLimit); + } + } + + return result; +} + + +/** +* @brief Read VF Curve +* +* @details +* - Read the Voltage-Frequency Curve +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - CTL_RESULT_ERROR_INVALID_ENUMERATION +* + `::CTL_VF_CURVE_TYPE_LIVE < VFCurveType` +* + `::CTL_VF_CURVE_DETAILS_ELABORATE < VFCurveDetail` +* - CTL_RESULT_ERROR_UNKNOWN - "Unknown Error" +*/ +ctl_result_t CTL_APICALL +ctlOverclockReadVFCurve( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] Handle to control device adapter + ctl_vf_curve_type_t VFCurveType, ///< [in] Type of Curve to read + ctl_vf_curve_details_t VFCurveDetail, ///< [in] Detail of Curve to read + uint32_t * pNumPoints, ///< [in][out] Number of points in the custom VF curve. If the NumPoints is + ///< zero, then the api will update the value with total number of Points + ///< based on requested VFCurveType and VFCurveDetail. If the NumPoints is + ///< non-zero, then the api will read and update the VF points in + ///< pVFCurveTable buffer provided. If the NumPoints doesn't match what the + ///< api returned in the first call, it will return an error. + ctl_voltage_frequency_point_t * pVFCurveTable ///< [in][out] Pointer to array of VF points, to copy the VF curve being + ///< read + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockReadVFCurve_t pfnOverclockReadVFCurve = (ctl_pfnOverclockReadVFCurve_t)GetProcAddress(hinstLibPtr, "ctlOverclockReadVFCurve"); + if (pfnOverclockReadVFCurve) + { + result = pfnOverclockReadVFCurve(hDeviceAdapter, VFCurveType, VFCurveDetail, pNumPoints, pVFCurveTable); + } + } + + return result; +} + + +/** +* @brief Write Custom VF curve +* +* @details +* - Modify the Voltage-Frequency Curve used by GPU +* - Valid Voltage-Frequency Curve shall have Voltage and Frequency Points +* in increasing order +* - Recommended to create Custom V-F Curve from reading Current V-F Curve +* using ::ctlOverclockReadVFCurve (Read-Modify-Write) +* - If Custom V-F curve write request is Successful, the Applied VF Curve +* might be slightly different than what is originally requested, +* recommended to update the UI by reading the V-F curve again using +* ctlOverclockReadVFCurve (with ctl_vf_curve_type_t::LIVE as input) +* - The overclock waiver must be set before calling this function +* otherwise error will be returned. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDeviceAdapter` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pCustomVFCurveTable` +* - CTL_RESULT_ERROR_UNKNOWN - "Unknown Error" +*/ +ctl_result_t CTL_APICALL +ctlOverclockWriteCustomVFCurve( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] Handle to control device adapter + uint32_t NumPoints, ///< [in] Number of points in the custom VF curve + ctl_voltage_frequency_point_t* pCustomVFCurveTable ///< [in] Pointer to an array of VF Points containing 'NumPoints' Custom VF + ///< points + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnOverclockWriteCustomVFCurve_t pfnOverclockWriteCustomVFCurve = (ctl_pfnOverclockWriteCustomVFCurve_t)GetProcAddress(hinstLibPtr, "ctlOverclockWriteCustomVFCurve"); + if (pfnOverclockWriteCustomVFCurve) + { + result = pfnOverclockWriteCustomVFCurve(hDeviceAdapter, NumPoints, pCustomVFCurveTable); + } + } + + return result; +} + + /** * @brief Get PCI properties - address, max speed * diff --git a/include/igcl_api.h b/include/igcl_api.h index f868693..0b06871 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -405,6 +405,18 @@ typedef enum _ctl_result_t ///< device is reset. CTL_RESULT_ERROR_CORE_OVERCLOCK_WAIVER_NOT_SET = 0x44000008,///< The $OverclockWaiverSet function has not been called. CTL_RESULT_ERROR_CORE_OVERCLOCK_DEPRECATED_API = 0x44000009,///< The error indicates to switch to newer API version if applicable. + CTL_RESULT_ERROR_CORE_LED_GET_STATE_NOT_SUPPORTED_FOR_I2C_LED = 0x4400000a, ///< The error indicates that driver cannot get Led state if Led is i2c + ///< supported + CTL_RESULT_ERROR_CORE_LED_SET_STATE_NOT_SUPPORTED_FOR_I2C_LED = 0x4400000b, ///< The error indicates that driver cannot set Led state if Led is i2c + ///< supported + CTL_RESULT_ERROR_CORE_LED_TOO_FREQUENT_SET_REQUESTS = 0x4400000c, ///< The error indicates that Set Led State request is called too + ///< frequently too fast + CTL_RESULT_ERROR_CORE_OVERCLOCK_VRAM_MEMORY_SPEED_OUTSIDE_RANGE = 0x4400000d, ///< The VRAM Memory Speed exceeds the acceptable min/max. + CTL_RESULT_ERROR_CORE_OVERCLOCK_INVALID_CUSTOM_VF_CURVE = 0x4400000e, ///< Invalid Custom VF Curve applied using OverclockWriteCustomVFCurve. + ///< Valid VF Curve contains VF Curve Points which are within min/max of + ///< gpuVFCurveVoltageLimit, gpuVFCurveFrequencyLimit parameters in + ///< ctl_oc_properties_t structure and VFCurve points with distinct volages + ///< in ascending order, frequencies in ascending order. CTL_RESULT_ERROR_CORE_END = 0x0440FFFF, ///< "Core error code end value, not to be used ///< " CTL_RESULT_ERROR_3D_START = 0x60000000, ///< 3D error code starting value, not to be used @@ -462,7 +474,7 @@ typedef enum _ctl_result_t /////////////////////////////////////////////////////////////////////////////// #ifndef CTL_MAX_RESERVED_SIZE /// @brief Maximum reserved size for future members. -#define CTL_MAX_RESERVED_SIZE 112 +#define CTL_MAX_RESERVED_SIZE 108 #endif // CTL_MAX_RESERVED_SIZE /////////////////////////////////////////////////////////////////////////////// @@ -751,6 +763,7 @@ typedef struct _ctl_device_adapter_properties_t uint16_t pci_subsys_id; ///< [out] PCI SubSys ID, Supported only for Version > 1 uint16_t pci_subsys_vendor_id; ///< [out] PCI SubSys Vendor ID, Supported only for Version > 1 ctl_adapter_bdf_t adapter_bdf; ///< [out] Pci Bus, Device, Function. Supported only for Version > 1 + uint32_t num_xe_cores; ///< [out] Number of Xe Cores. Supported only for Version > 2 char reserved[CTL_MAX_RESERVED_SIZE]; ///< [out] Reserved } ctl_device_adapter_properties_t; @@ -1402,6 +1415,10 @@ typedef struct _ctl_psu_info_t ctl_psu_info_t; /// @brief Forward-declare ctl_power_telemetry_t typedef struct _ctl_power_telemetry_t ctl_power_telemetry_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_voltage_frequency_point_t +typedef struct _ctl_voltage_frequency_point_t ctl_voltage_frequency_point_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ctl_pci_address_t typedef struct _ctl_pci_address_t ctl_pci_address_t; @@ -5719,6 +5736,9 @@ ctlLedGetState( /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. +/// - This API is rate-limited by 500 milliseconds, If this API is called +/// too frequently ::CTL_ERROR_CORE_LED_TOO_FREQUENT_SET_REQUESTS error +/// will be returned /// /// @returns /// - CTL_RESULT_SUCCESS @@ -6341,12 +6361,18 @@ typedef struct _ctl_oc_properties_t uint32_t Size; ///< [in] size of this structure uint8_t Version; ///< [in] version of this structure bool bSupported; ///< [out] Indicates if the adapter supports overclocking. - ctl_oc_control_info_t gpuFrequencyOffset; ///< [out] related to function ::ctlOverclockGpuFrequencyOffsetSet - ctl_oc_control_info_t gpuVoltageOffset; ///< [out] related to function ::ctlOverclockGpuVoltageOffsetSet + ctl_oc_control_info_t gpuFrequencyOffset; ///< [out] related to function ::ctlOverclockGpuFrequencyOffsetSetV2 + ctl_oc_control_info_t gpuVoltageOffset; ///< [out] related to function ::ctlOverclockGpuMaxVoltageOffsetSetV2 ctl_oc_control_info_t vramFrequencyOffset; ///< [out] Property Field Deprecated / No Longer Supported ctl_oc_control_info_t vramVoltageOffset; ///< [out] Property Field Deprecated / No Longer Supported - ctl_oc_control_info_t powerLimit; ///< [out] related to function ::ctlOverclockPowerLimitSet - ctl_oc_control_info_t temperatureLimit; ///< [out] related to function ::ctlOverclockTemperatureLimitSet + ctl_oc_control_info_t powerLimit; ///< [out] related to function ::ctlOverclockPowerLimitSetV2 + ctl_oc_control_info_t temperatureLimit; ///< [out] related to function ::ctlOverclockTemperatureLimitSetV2 + ctl_oc_control_info_t vramMemSpeedLimit; ///< [out] related to function ::ctlOverclockVramMemSpeedLimitSetV2 + ///< Supported only for Version > 0 + ctl_oc_control_info_t gpuVFCurveVoltageLimit; ///< [out] related to function ::ctlOverclockWriteCustomVFCurve Supported + ///< only for Version > 0 + ctl_oc_control_info_t gpuVFCurveFrequencyLimit; ///< [out] related to function ::ctlOverclockWriteCustomVFCurve Supported + ///< only for Version > 0 } ctl_oc_properties_t; @@ -6435,20 +6461,20 @@ typedef struct _ctl_power_telemetry_t ///< percentage utilization of all media blocks in the GPU. bool gpuPowerLimited; ///< [out] Instantaneous indication that the desired GPU frequency is being ///< throttled because the GPU chip is exceeding the maximum power limits. - ///< Increasing the power limits using ::ctlOverclockPowerLimitSet() is one - ///< way to remove this limitation. + ///< Increasing the power limits using ::ctlOverclockPowerLimitSetV2() is + ///< one way to remove this limitation. bool gpuTemperatureLimited; ///< [out] Instantaneous indication that the desired GPU frequency is being ///< throttled because the GPU chip is exceeding the temperature limits. ///< Increasing the temperature limits using - ///< ::ctlOverclockTemperatureLimitSet() is one way to reduce this + ///< ::ctlOverclockTemperatureLimitSetV2() is one way to reduce this ///< limitation. Improving the cooling solution is another way. bool gpuCurrentLimited; ///< [out] Instantaneous indication that the desired GPU frequency is being ///< throttled because the GPU chip has exceeded the power supply current ///< limits. A better power supply is required to reduce this limitation. bool gpuVoltageLimited; ///< [out] Instantaneous indication that the GPU frequency cannot be ///< increased because the voltage limits have been reached. Increase the - ///< voltage offset using ::ctlOverclockGpuVoltageOffsetSet() is one way to - ///< reduce this limitation. + ///< voltage offset using ::ctlOverclockGpuMaxVoltageOffsetSetV2() is one + ///< way to reduce this limitation. bool gpuUtilizationLimited; ///< [out] Instantaneous indication that due to lower GPU utilization, the ///< hardware has lowered the GPU frequency. ctl_oc_telemetry_item_t vramEnergyCounter; ///< [out] Snapshot of the monotonic energy counter maintained by hardware. @@ -6469,24 +6495,33 @@ typedef struct _ctl_power_telemetry_t ///< the write traffic to the memory modules. By taking the delta between ///< two snapshots and dividing by the delta time in seconds, an ///< application can compute the average write bandwidth. - ctl_oc_telemetry_item_t vramCurrentTemperature; ///< [out] Instantaneous snapshot of the GPU chip temperature, read from - ///< the sensor reporting the highest value. - bool vramPowerLimited; ///< [out] Instantaneous indication that the memory frequency is being - ///< throttled because the memory modules are exceeding the maximum power - ///< limits. - bool vramTemperatureLimited; ///< [out] Instantaneous indication that the memory frequency is being - ///< throttled because the memory modules are exceeding the temperature - ///< limits. - bool vramCurrentLimited; ///< [out] Instantaneous indication that the memory frequency is being - ///< throttled because the memory modules have exceeded the power supply - ///< current limits. - bool vramVoltageLimited; ///< [out] Instantaneous indication that the memory frequency cannot be - ///< increased because the voltage limits have been reached. - bool vramUtilizationLimited; ///< [out] Instantaneous indication that due to lower memory traffic, the - ///< hardware has lowered the memory frequency. + ctl_oc_telemetry_item_t vramCurrentTemperature; ///< [out] Instantaneous snapshot of the memory modules temperature, read + ///< from the sensor reporting the highest value. + bool vramPowerLimited; ///< [out] Deprecated / Not-supported, will always returns false + bool vramTemperatureLimited; ///< [out] Deprecated / Not-supported, will always returns false + bool vramCurrentLimited; ///< [out] Deprecated / Not-supported, will always returns false + bool vramVoltageLimited; ///< [out] Deprecated / Not-supported, will always returns false + bool vramUtilizationLimited; ///< [out] Deprecated / Not-supported, will always returns false ctl_oc_telemetry_item_t totalCardEnergyCounter; ///< [out] Total Card Energy Counter. ctl_psu_info_t psu[CTL_PSU_COUNT]; ///< [out] PSU voltage and power. ctl_oc_telemetry_item_t fanSpeed[CTL_FAN_COUNT];///< [out] Fan speed. + ctl_oc_telemetry_item_t gpuVrTemp; ///< [out] GPU VR temperature. Supported for Version > 0. + ctl_oc_telemetry_item_t vramVrTemp; ///< [out] VRAM VR temperature. Supported for Version > 0. + ctl_oc_telemetry_item_t saVrTemp; ///< [out] SA VR temperature. Supported for Version > 0. + ctl_oc_telemetry_item_t gpuEffectiveClock; ///< [out] Effective frequency of the GPU. Supported for Version > 0. + ctl_oc_telemetry_item_t gpuOverVoltagePercent; ///< [out] OverVoltage as a percent between 0 and 100. Positive values + ///< represent fraction of the maximum over-voltage increment being + ///< currently applied. Zero indicates operation at or below default + ///< maximum frequency. Supported for Version > 0. + ctl_oc_telemetry_item_t gpuPowerPercent; ///< [out] GPUPower expressed as a percent representing the fraction of the + ///< default maximum power being drawn currently. Values greater than 100 + ///< indicate power draw beyond default limits. Values above OC Power limit + ///< imply throttling due to power. Supported for Version > 0. + ctl_oc_telemetry_item_t gpuTemperaturePercent; ///< [out] GPUTemperature expressed as a percent of the thermal margin. + ///< Values of 100 or greater indicate thermal throttling and 0 indicates + ///< device at 0 degree Celcius. Supported for Version > 0. + ctl_oc_telemetry_item_t vramReadBandwidth; ///< [out] VRAM Read Bandwidth. Supported for Version > 0. + ctl_oc_telemetry_item_t vramWriteBandwidth; ///< [out] VRAM Write Bandwidth. Supported for Version > 0. } ctl_power_telemetry_t; @@ -6992,6 +7027,428 @@ ctlOverclockResetToDefault( ctl_device_adapter_handle_t hDeviceHandle ///< [in][release] Handle to display adapter ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief VF Curve Detail +typedef enum _ctl_vf_curve_details_t +{ + CTL_VF_CURVE_DETAILS_SIMPLIFIED = 0, ///< Read minimum num of VF points for simplified VF curve view + CTL_VF_CURVE_DETAILS_MEDIUM = 1, ///< Read medium num of VF points for more points than simplified view + CTL_VF_CURVE_DETAILS_ELABORATE = 2, ///< Read Maximum num of VF points for detailed VF curve View + CTL_VF_CURVE_DETAILS_MAX + +} ctl_vf_curve_details_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief VF Curve type +typedef enum _ctl_vf_curve_type_t +{ + CTL_VF_CURVE_TYPE_STOCK = 0, ///< Read default VF curve + CTL_VF_CURVE_TYPE_LIVE = 1, ///< Read Live VF Curve + CTL_VF_CURVE_TYPE_MAX + +} ctl_vf_curve_type_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Overclock Voltage Frequency Point +typedef struct _ctl_voltage_frequency_point_t +{ + uint32_t Voltage; ///< [in][out] in milliVolts + uint32_t Frequency; ///< [in][out] in MHz + +} ctl_voltage_frequency_point_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the Current Overclock GPU Frequency Offset +/// +/// @details +/// - Determine the current frequency offset in effect (refer to +/// ::ctlOverclockGpuFrequencyOffsetSetV2() for details). +/// - The unit of the value returned is given in +/// ::ctl_oc_properties_t::gpuFrequencyOffset::units returned from +/// ::ctlOverclockGetProperties() +/// - The unit of the value returned can be different for different +/// generation of graphics product +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcFrequencyOffset` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuFrequencyOffsetGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcFrequencyOffset ///< [in,out] Current GPU Overclock Frequency Offset in units given in + ///< ::ctl_oc_properties_t::gpuFrequencyOffset::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the Overclock Frequency Offset for the GPU +/// +/// @details +/// - The purpose of this function is to increase/decrease the frequency +/// offset at which typical workloads will run within the same thermal +/// budget. +/// - The frequency offset is expressed in units given in +/// ::ctl_oc_properties_t::gpuFrequencyOffset::units returned from +/// ::ctlOverclockGetProperties() +/// - The actual operating frequency for each workload is not guaranteed to +/// change exactly by the specified offset. +/// - For positive frequency offsets, the factory maximum frequency may +/// increase by up to the specified amount. +/// - Specifying large values for the frequency offset can lead to +/// instability. It is recommended that changes are made in small +/// increments and stability/performance measured running intense GPU +/// workloads before increasing further. +/// - This setting is not persistent through system reboots or driver +/// resets/hangs. It is up to the overclock application to reapply the +/// settings in those cases. +/// - This setting can cause system/device instability. It is up to the +/// overclock application to detect if the system has rebooted +/// unexpectedly or the device was restarted. When this occurs, the +/// application should not reapply the overclock settings automatically +/// but instead return to previously known good settings or notify the +/// user that the settings are not being applied. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuFrequencyOffsetSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocFrequencyOffset ///< [in] The GPU Overclocking Frequency Offset Desired in units given in + ///< ::ctl_oc_properties_t::gpuFrequencyOffset::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the Current Overclock Voltage Offset for the GPU +/// +/// @details +/// - Determine the current maximum voltage offset in effect on the hardware +/// (refer to ::ctlOverclockGpuMaxVoltageOffsetSetV2 for details). +/// - The unit of the value returned is given in +/// ::ctl_oc_properties_t::gpuVoltageOffset::units returned from +/// ::ctlOverclockGetProperties() +/// - The unit of the value returned can be different for different +/// generation of graphics product +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcMaxVoltageOffset` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuMaxVoltageOffsetGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcMaxVoltageOffset ///< [in,out] Current Overclock GPU Voltage Offset in Units given in + ///< ::ctl_oc_properties_t::gpuVoltageOffset::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the Overclock Voltage Offset for the GPU +/// +/// @details +/// - The purpose of this function is to attempt to run the GPU up to higher +/// voltages beyond the part warrantee limits. This can permit running at +/// even higher frequencies than can be obtained using the frequency +/// offset setting, but at the risk of reducing the lifetime of the part. +/// - The voltage offset is expressed in units given in +/// ::ctl_oc_properties_t::gpuVoltageOffset::units returned from +/// ::ctlOverclockGetProperties() +/// - The overclock waiver must be set before calling this function +/// otherwise error will be returned. +/// - There is no guarantee that a workload can operate at the higher +/// frequencies permitted by this setting. Significantly more heat will be +/// generated at these high frequencies/voltages which will necessitate a +/// good cooling solution. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockGpuMaxVoltageOffsetSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocMaxVoltageOffset ///< [in] The Overclocking Maximum Voltage Desired in units given in + ///< ::ctl_oc_properties_t::gpuVoltageOffset::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the current Overclock Vram Memory Speed +/// +/// @details +/// - The purpose of this function is to return the current VRAM Memory +/// Speed +/// - The unit of the value returned is given in +/// ::ctl_oc_properties_t::vramMemSpeedLimit::units returned from +/// ::ctlOverclockGetProperties() +/// - The unit of the value returned can be different for different +/// generation of graphics product +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pOcVramMemSpeedLimit` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockVramMemSpeedLimitGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pOcVramMemSpeedLimit ///< [in,out] The current VRAM Memory Speed in units given in + ///< ::ctl_oc_properties_t::vramMemSpeedLimit::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the desired Overclock Vram Memory Speed +/// +/// @details +/// - The purpose of this function is to increase/decrease the Speed of +/// VRAM. +/// - The Memory Speed is expressed in units given in +/// ::ctl_oc_properties_t::vramMemSpeedLimit::units returned from +/// ::ctlOverclockGetProperties() with a minimum step size given by +/// ::ctlOverclockGetProperties(). +/// - The actual Memory Speed for each workload is not guaranteed to change +/// exactly by the specified offset. +/// - This setting is not persistent through system reboots or driver +/// resets/hangs. It is up to the overclock application to reapply the +/// settings in those cases. +/// - This setting can cause system/device instability. It is up to the +/// overclock application to detect if the system has rebooted +/// unexpectedly or the device was restarted. When this occurs, the +/// application should not reapply the overclock settings automatically +/// but instead return to previously known good settings or notify the +/// user that the settings are not being applied. +/// - If the memory controller doesn't support changes to memory speed on +/// the fly, one of the following return codes will be given: +/// - CTL_RESULT_ERROR_RESET_DEVICE_REQUIRED: The requested memory overclock +/// will be applied when the device is reset or the system is rebooted. In +/// this case, the overclock software should check if the overclock +/// request was applied after the reset/reboot. If it was and when the +/// overclock application shuts down gracefully and if the overclock +/// application wants the setting to be persistent, the application should +/// request the same overclock settings again so that they will be applied +/// on the next reset/reboot. If this is not done, then every time the +/// device is reset and overclock is requested, the device needs to be +/// reset a second time. +/// - CTL_RESULT_ERROR_FULL_REBOOT_REQUIRED: The requested memory overclock +/// will be applied when the system is rebooted. In this case, the +/// overclock software should check if the overclock request was applied +/// after the reboot. If it was and when the overclock application shuts +/// down gracefully and if the overclock application wants the setting to +/// be persistent, the application should request the same overclock +/// settings again so that they will be applied on the next reset/reboot. +/// If this is not done and the overclock setting is requested after the +/// reboot has occurred, a second reboot will be required. +/// - CTL_RESULT_ERROR_UNSUPPORTED_FEATURE: The Memory Speed Get / Set +/// Feature is currently not available or Unsupported in current platform +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockVramMemSpeedLimitSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double ocVramMemSpeedLimit ///< [in] The desired Memory Speed in units given in + ///< ::ctl_oc_properties_t::vramMemSpeedLimit::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the Current Sustained power limit +/// +/// @details +/// - The purpose of this function is to read the current sustained power +/// limit. +/// - The unit of the value returned is given in +/// ::ctl_oc_properties_t::powerLimit::units returned from +/// ::ctlOverclockGetProperties() +/// - The unit of the value returned can be different for different +/// generation of graphics product +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pSustainedPowerLimit` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockPowerLimitGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pSustainedPowerLimit ///< [in,out] The current Sustained Power limit in Units given in + ///< ::ctl_oc_properties_t::powerLimit::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the Sustained power limit +/// +/// @details +/// - The purpose of this function is to set the maximum sustained power +/// limit. If the average GPU power averaged over a few seconds exceeds +/// this value, the frequency of the GPU will be throttled. +/// - Set a value of 0 to disable this power limit. In this case, the GPU +/// frequency will not throttle due to average power but may hit other +/// limits. +/// - The unit of the PowerLimit to be set is given in +/// ::ctl_oc_properties_t::powerLimit::units returned from +/// ::ctlOverclockGetProperties() +/// - The unit of the value returned can be different for different +/// generation of graphics product +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockPowerLimitSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double sustainedPowerLimit ///< [in] The desired sustained power limit in Units given in + ///< ::ctl_oc_properties_t::powerLimit::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get the current temperature limit +/// +/// @details +/// - The purpose of this function is to read the current thermal limit used +/// for Overclocking +/// - The unit of the value returned is given in +/// ::ctl_oc_properties_t::temperatureLimit::units returned from +/// ::ctlOverclockGetProperties() +/// - The unit of the value returned can be different for different +/// generation of graphics product +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pTemperatureLimit` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockTemperatureLimitGetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double* pTemperatureLimit ///< [in,out] The current temperature limit in Units given in + ///< ::ctl_oc_properties_t::temperatureLimit::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set the temperature limit +/// +/// @details +/// - The purpose of this function is to change the maximum thermal limit. +/// When the GPU temperature exceeds this value, the GPU frequency will be +/// throttled. +/// - The unit of the value to be set is given in +/// ::ctl_oc_properties_t::temperatureLimit::units returned from +/// ::ctlOverclockGetProperties() +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceHandle` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockTemperatureLimitSetV2( + ctl_device_adapter_handle_t hDeviceHandle, ///< [in][release] Handle to display adapter + double temperatureLimit ///< [in] The desired temperature limit in Units given in + ///< ::ctl_oc_properties_t::temperatureLimit::units returned from + ///< ::ctlOverclockGetProperties() + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Read VF Curve +/// +/// @details +/// - Read the Voltage-Frequency Curve +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - CTL_RESULT_ERROR_INVALID_ENUMERATION +/// + `::CTL_VF_CURVE_TYPE_LIVE < VFCurveType` +/// + `::CTL_VF_CURVE_DETAILS_ELABORATE < VFCurveDetail` +/// - CTL_RESULT_ERROR_UNKNOWN - "Unknown Error" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockReadVFCurve( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] Handle to control device adapter + ctl_vf_curve_type_t VFCurveType, ///< [in] Type of Curve to read + ctl_vf_curve_details_t VFCurveDetail, ///< [in] Detail of Curve to read + uint32_t * pNumPoints, ///< [in][out] Number of points in the custom VF curve. If the NumPoints is + ///< zero, then the api will update the value with total number of Points + ///< based on requested VFCurveType and VFCurveDetail. If the NumPoints is + ///< non-zero, then the api will read and update the VF points in + ///< pVFCurveTable buffer provided. If the NumPoints doesn't match what the + ///< api returned in the first call, it will return an error. + ctl_voltage_frequency_point_t * pVFCurveTable ///< [in][out] Pointer to array of VF points, to copy the VF curve being + ///< read + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Write Custom VF curve +/// +/// @details +/// - Modify the Voltage-Frequency Curve used by GPU +/// - Valid Voltage-Frequency Curve shall have Voltage and Frequency Points +/// in increasing order +/// - Recommended to create Custom V-F Curve from reading Current V-F Curve +/// using ::ctlOverclockReadVFCurve (Read-Modify-Write) +/// - If Custom V-F curve write request is Successful, the Applied VF Curve +/// might be slightly different than what is originally requested, +/// recommended to update the UI by reading the V-F curve again using +/// ctlOverclockReadVFCurve (with ctl_vf_curve_type_t::LIVE as input) +/// - The overclock waiver must be set before calling this function +/// otherwise error will be returned. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDeviceAdapter` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pCustomVFCurveTable` +/// - CTL_RESULT_ERROR_UNKNOWN - "Unknown Error" +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlOverclockWriteCustomVFCurve( + ctl_device_adapter_handle_t hDeviceAdapter, ///< [in][release] Handle to control device adapter + uint32_t NumPoints, ///< [in] Number of points in the custom VF curve + ctl_voltage_frequency_point_t* pCustomVFCurveTable ///< [in] Pointer to an array of VF Points containing 'NumPoints' Custom VF + ///< points + ); + #if !defined(__GNUC__) #pragma endregion // overclock @@ -8285,6 +8742,106 @@ typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockResetToDefault_t)( ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuFrequencyOffsetGetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuFrequencyOffsetGetV2_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuFrequencyOffsetSetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuFrequencyOffsetSetV2_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuMaxVoltageOffsetGetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuMaxVoltageOffsetGetV2_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockGpuMaxVoltageOffsetSetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockGpuMaxVoltageOffsetSetV2_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockVramMemSpeedLimitGetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramMemSpeedLimitGetV2_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockVramMemSpeedLimitSetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockVramMemSpeedLimitSetV2_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockPowerLimitGetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockPowerLimitGetV2_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockPowerLimitSetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockPowerLimitSetV2_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockTemperatureLimitGetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockTemperatureLimitGetV2_t)( + ctl_device_adapter_handle_t, + double* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockTemperatureLimitSetV2 +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockTemperatureLimitSetV2_t)( + ctl_device_adapter_handle_t, + double + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockReadVFCurve +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockReadVFCurve_t)( + ctl_device_adapter_handle_t, + ctl_vf_curve_type_t, + ctl_vf_curve_details_t, + uint32_t *, + ctl_voltage_frequency_point_t * + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlOverclockWriteCustomVFCurve +typedef ctl_result_t (CTL_APICALL *ctl_pfnOverclockWriteCustomVFCurve_t)( + ctl_device_adapter_handle_t, + uint32_t, + ctl_voltage_frequency_point_t* + ); + + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for ctlPciGetProperties typedef ctl_result_t (CTL_APICALL *ctl_pfnPciGetProperties_t)( From 7a9cf8e0305cec8c03822cc251398b9e81ba9196 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Fri, 9 May 2025 03:34:46 -0700 Subject: [PATCH 17/26] Updated version to v240 --- Samples/FirmwareApi/FirmwareApiApp.cpp | 6 +- .../I2C_AUX_Samples/I2C_AUX_Sample_App.cpp | 70 ++++++++++--------- .../Panel_descriptor_Sample_App.cpp | 40 +++++------ Source/cApiWrapper.cpp | 2 +- include/igcl_api.h | 2 +- 5 files changed, 62 insertions(+), 58 deletions(-) diff --git a/Samples/FirmwareApi/FirmwareApiApp.cpp b/Samples/FirmwareApi/FirmwareApiApp.cpp index a87cfdd..e631196 100644 --- a/Samples/FirmwareApi/FirmwareApiApp.cpp +++ b/Samples/FirmwareApi/FirmwareApiApp.cpp @@ -179,6 +179,10 @@ int main() if (res == CTL_RESULT_SUCCESS) { if (BaseFwProperties.FirmwareConfig & CTL_FIRMWARE_CONFIG_FLAG_IS_DEVICE_LINK_SPEED_DOWNGRADE_CAPABLE) + { + printf("FW supports Gen5 to Gen4 downgrade capability\n"); + } + else { printf("FW does not support Gen5 to Gen4 downgrade capability\n"); continue; @@ -189,8 +193,6 @@ int main() printf("We already attempted to go to Gen5 and it probably failed, nothing else to do now"); continue; } - - printf("FW supports Gen5 to Gen4 downgrade capability\n"); } else { diff --git a/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp b/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp index cac6e38..4dd9d5c 100644 --- a/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp +++ b/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp @@ -39,7 +39,7 @@ ctl_result_t TestI2CAUXAccess(ctl_display_output_handle_t hDisplayOutput) ctl_aux_access_args_t AUXArgs = { 0 }; // AUX Access WRITE ctl_i2c_access_args_t I2CArgs = { 0 }; // I2C Access - printf("Aux Read Test.\n"); + APP_LOG_INFO("Aux Read Test."); AUXArgs.Size = sizeof(ctl_aux_access_args_t); AUXArgs.OpType = CTL_OPERATION_TYPE_WRITE; @@ -52,7 +52,7 @@ ctl_result_t TestI2CAUXAccess(ctl_display_output_handle_t hDisplayOutput) if (CTL_RESULT_SUCCESS != Result) { - printf("ctlAUXAccess for Native Aux DPCD WRITE returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlAUXAccess for Native Aux DPCD WRITE returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -69,7 +69,7 @@ ctl_result_t TestI2CAUXAccess(ctl_display_output_handle_t hDisplayOutput) if (CTL_RESULT_SUCCESS != Result) { - printf("ctlAUXAccess for Native Aux DPCD Read returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlAUXAccess for Native Aux DPCD Read returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } else @@ -77,11 +77,11 @@ ctl_result_t TestI2CAUXAccess(ctl_display_output_handle_t hDisplayOutput) // Print the data for (uint32_t j = 0; j < AUXArgs.DataSize; j++) { - printf("Read data[%d] = : 0x%X\n", j, AUXArgs.Data[j]); + APP_LOG_INFO("Read data[%d] = : 0x%X", j, AUXArgs.Data[j]); } } - printf("I2C Write Test.\n"); + APP_LOG_INFO("I2C Write Test."); // I2C WRITE : 82 01 10 AC at adddress 6E and subaddress 51 // If we write these BYTEs ( 82 01 10 AC) to adddress 6E and @@ -112,10 +112,10 @@ ctl_result_t TestI2CAUXAccess(ctl_display_output_handle_t hDisplayOutput) if (CTL_RESULT_SUCCESS != Result) { - printf("ctlI2CAccess for I2C write returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlI2CAccess for I2C write returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } - printf("I2C Read Test.\n"); + APP_LOG_INFO("I2C Read Test."); // I2C READ : 82 01 10 AC at adddress 6E and subaddress 51 I2CArgs.Size = sizeof(ctl_i2c_access_args_t); I2CArgs.OpType = CTL_OPERATION_TYPE_READ; @@ -130,7 +130,7 @@ ctl_result_t TestI2CAUXAccess(ctl_display_output_handle_t hDisplayOutput) // Print the data for (uint32_t j = 0; j < I2CArgs.DataSize; j++) { - printf("Read data[%d] = : 0x%X\n", j, I2CArgs.Data[j]); + APP_LOG_INFO("Read data[%d] = : 0x%X", j, I2CArgs.Data[j]); } Exit: @@ -172,16 +172,16 @@ ctl_result_t TestI2CAUXAccessOnPinPair(ctl_i2c_pin_pair_handle_t hI2cPinPair) I2CArgs.Data[2] = 0x10; I2CArgs.Data[3] = 0xAC; - printf("I2C Write Test: Address %#x, Offset %#x, size %d.\n", I2CArgs.Address, I2CArgs.Offset, I2CArgs.DataSize); + APP_LOG_INFO("I2C Write Test: Address %#x, Offset %#x, size %d.", I2CArgs.Address, I2CArgs.Offset, I2CArgs.DataSize); Result = ctlI2CAccessOnPinPair(hI2cPinPair, &I2CArgs); if (CTL_RESULT_SUCCESS != Result) { - printf("I2C write returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("I2C write returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } else { - printf("I2C Write Test Success.\n"); + APP_LOG_INFO("I2C Write Test Success."); } ZeroMemory(&I2CArgs, sizeof(I2CArgs)); @@ -196,18 +196,18 @@ ctl_result_t TestI2CAUXAccessOnPinPair(ctl_i2c_pin_pair_handle_t hI2cPinPair) // I2CArgs.Flags |= CTL_I2C_FLAG_SPEED_BIT_BASH; // I2CArgs.Flags = CTL_I2C_FLAG_ATOMICI2C; // Need to set this to do Atomic I2C call - printf("I2C Read Test: Address %#X, Offset %#X, size %d, Flags %#X.\n", I2CArgs.Address, I2CArgs.Offset, I2CArgs.DataSize, I2CArgs.Flags); + APP_LOG_INFO("I2C Read Test: Address %#X, Offset %#X, size %d, Flags %#X.", I2CArgs.Address, I2CArgs.Offset, I2CArgs.DataSize, I2CArgs.Flags); Result = ctlI2CAccessOnPinPair(hI2cPinPair, &I2CArgs); LOG_AND_EXIT_ON_ERROR(Result, "ctlI2CAccessOnPinPair for I2C read"); // Print the data for (uint32_t j = 0; j < I2CArgs.DataSize; j++) { - printf("Read data[%d] = : 0x%X\n", j, I2CArgs.Data[j]); + APP_LOG_INFO("Read data[%d] = : 0x%X", j, I2CArgs.Data[j]); } Exit: - printf("\n-------------------------\n"); + PRINT_LOGS("-------------------------"); return Result; } @@ -226,7 +226,8 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput { ctl_display_properties_t DisplayProperties = { 0 }; DisplayProperties.Size = sizeof(ctl_display_properties_t); - printf("Display Handle: %p\n-------------------------\n", hDisplayOutput[DisplayIndex]); + APP_LOG_INFO("Display Handle: %p", hDisplayOutput[DisplayIndex]); + PRINT_LOGS("-------------------------"); Result = ctlGetDisplayProperties(hDisplayOutput[DisplayIndex], &DisplayProperties); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetDisplayProperties"); @@ -234,7 +235,7 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput if (FALSE == IsDisplayAttached) { - printf("Display %d is not attached, skipping the call for this display\n", DisplayIndex); + APP_LOG_WARN("Display %d is not attached, skipping the call for this display", DisplayIndex); continue; } @@ -257,7 +258,8 @@ ctl_result_t TestI2cAccessOnEmumeratedPinPairs(ctl_i2c_pin_pair_handle_t *hI2cPi ctl_result_t Result = CTL_RESULT_SUCCESS; for (uint32_t Index = 0; Index < PinPairCount; Index++) { - printf("I2CAccessOnPinPair Test for Pin Pair[%d] handle: %p\n-------------------------\n", Index, hI2cPinPair[Index]); + APP_LOG_INFO("I2CAccessOnPinPair Test for Pin Pair[%d] handle: %p", Index, hI2cPinPair[Index]); + PRINT_LOGS("-------------------------"); Result = TestI2CAUXAccessOnPinPair(hI2cPinPair[Index]); STORE_AND_RESET_ERROR(Result); } @@ -279,7 +281,8 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) { - printf("Adapter Handle: %p\n===============================\n", hDevices[AdapterIndex]); + APP_LOG_INFO("Adapter Handle: %p", hDevices[AdapterIndex]); + PRINT_LOGS("==============================="); // enumerate all the possible target display's for the adapters // first step is to get the count @@ -289,13 +292,13 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } else if (DisplayCount <= 0) { - printf("Invalid Display Count. skipping display enumration for adapter:%d\n", AdapterIndex); + APP_LOG_WARN("Invalid Display Count. skipping display enumration for adapter:%d", AdapterIndex); continue; } @@ -306,7 +309,7 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -316,7 +319,7 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateDisplayHandles returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateDisplayHandles returned failure code: 0x%X", Result); } CTL_FREE_MEM(hDisplayOutput); @@ -342,7 +345,8 @@ ctl_result_t EnumerateI2CDevices(uint32_t AdapterCount, ctl_device_adapter_handl for (uint32_t AdapterIndex = 0; AdapterIndex < AdapterCount; AdapterIndex++) { - printf("\nI2C Access Test For Adapter[%d] handle: %p\n===========================\n", AdapterIndex, hDevices[AdapterIndex]); + APP_LOG_INFO("I2C Access Test For Adapter[%d] handle: %p", AdapterIndex, hDevices[AdapterIndex]); + PRINT_LOGS("==========================="); // enumerate all the possible target display's for the adapters // first step is to get the count PinCount = 0; @@ -351,13 +355,13 @@ ctl_result_t EnumerateI2CDevices(uint32_t AdapterCount, ctl_device_adapter_handl if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateI2CPinPairs returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlEnumerateI2CPinPairs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } else if (PinCount <= 0) { - printf("Invalid Display Count. skipping pin pair enumration for adapter:%d\n", AdapterIndex); + APP_LOG_ERROR("Invalid Display Count. skipping pin pair enumration for adapter:%d", AdapterIndex); continue; } @@ -368,7 +372,7 @@ ctl_result_t EnumerateI2CDevices(uint32_t AdapterCount, ctl_device_adapter_handl if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateI2CPinPairs returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlEnumerateI2CPinPairs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -378,7 +382,7 @@ ctl_result_t EnumerateI2CDevices(uint32_t AdapterCount, ctl_device_adapter_handl if (CTL_RESULT_SUCCESS != Result) { - printf("TestI2cAccessOnEmumeratedPinPairs returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("TestI2cAccessOnEmumeratedPinPairs returned failure code: 0x%X", Result); } CTL_FREE_MEM(hI2cPinPair); @@ -420,7 +424,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -432,7 +436,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -445,21 +449,21 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } Result = EnumerateTargetDisplays(AdapterCount, hDevices); if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateTargetDisplays returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateTargetDisplays returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } #if 0 // Keeping the call disabled as not needed for regular Display use cases. Mainly intended for non-display devices. Result = EnumerateI2CDevices(AdapterCount, hDevices); if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateI2CDevices returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateI2CDevices returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } #endif @@ -467,7 +471,7 @@ int main() ctlClose(hAPIHandle); CTL_FREE_MEM(hDevices); - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } diff --git a/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp b/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp index 97eb1a3..4481c98 100644 --- a/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp +++ b/Samples/Panel_descriptor_Samples/Panel_descriptor_Sample_App.cpp @@ -43,7 +43,7 @@ ctl_result_t GetPanelDescriptor(ctl_display_output_handle_t hDisplayOutput, ctl_ // Print the descriptor data size DescriptorDataSize = pPanelDescArgs->DescriptorDataSize; - printf("DescriptorDataSize = : %d\n", DescriptorDataSize); + APP_LOG_INFO("DescriptorDataSize = : %d", DescriptorDataSize); // Once we have the size of the descriptor data, do another call to ctlPanelDescriptorAccess with DescriptorDataSize as the value derived from 1st ctlPanelDescriptorAccess // call. @@ -58,14 +58,13 @@ ctl_result_t GetPanelDescriptor(ctl_display_output_handle_t hDisplayOutput, ctl_ Result = ctlPanelDescriptorAccess(hDisplayOutput, pPanelDescArgs); LOG_AND_EXIT_ON_ERROR(Result, "ctlPanelDescriptorAccess"); - printf("Panel Descriptor Data on block %d: \n", pPanelDescArgs->BlockNumber); + APP_LOG_INFO("Panel Descriptor Data on block %d: ", pPanelDescArgs->BlockNumber); for (uint32_t i = 0; i < pPanelDescArgs->DescriptorDataSize; i += 16) { for (uint32_t j = i; j < (i + 16); j++) { - printf("0x%02X ", pPanelDescArgs->pDescriptorData[j]); + APP_LOG_INFO("0x%02X ", pPanelDescArgs->pDescriptorData[j]); } - printf("\n"); } // EXTENSION BLOCKS READ : For EDID, Need to get the number of extensions blocks from 127th byte of base block @@ -73,7 +72,7 @@ ctl_result_t GetPanelDescriptor(ctl_display_output_handle_t hDisplayOutput, ctl_ if (0 == NumberOfExtnBlocks) { - printf("No Extn Block found \n"); + APP_LOG_ERROR("No Extn Block found "); goto Exit; } @@ -94,7 +93,7 @@ ctl_result_t GetPanelDescriptor(ctl_display_output_handle_t hDisplayOutput, ctl_ // Print the descriptor data size ExtBlockDescriptorDataSize = ExtBlockPanelDescArgs.DescriptorDataSize; - printf("DescriptorDataSize for extension block = : %d\n", ExtBlockDescriptorDataSize); + APP_LOG_INFO("DescriptorDataSize for extension block = : %d", ExtBlockDescriptorDataSize); // Once we have the size of the descriptor data, do another call to ctlPanelDescriptorAccess with DescriptorDataSize as the value derived from 1st // ctlPanelDescriptorAcces call. @@ -111,19 +110,18 @@ ctl_result_t GetPanelDescriptor(ctl_display_output_handle_t hDisplayOutput, ctl_ if (CTL_RESULT_SUCCESS != Result) { - printf("ctlPanelDescriptorAccess for extension block %d returned failure code: 0x%X\n", BlockIndex, Result); + APP_LOG_ERROR("ctlPanelDescriptorAccess for extension block %d returned failure code: 0x%X", BlockIndex, Result); CTL_FREE_MEM(ExtBlockPanelDescArgs.pDescriptorData); goto Exit; } - printf("Panel Descriptor Data on block %d: \n", ExtBlockPanelDescArgs.BlockNumber); + APP_LOG_INFO("Panel Descriptor Data on block %d: ", ExtBlockPanelDescArgs.BlockNumber); for (uint32_t i = 0; i < pPanelDescArgs->DescriptorDataSize; i += 16) { for (uint32_t j = i; j < (i + 16); j++) { - printf("0x%02X ", ExtBlockPanelDescArgs.pDescriptorData[j]); + APP_LOG_INFO("0x%02X ", ExtBlockPanelDescArgs.pDescriptorData[j]); } - printf("\n"); } CTL_FREE_MEM(ExtBlockPanelDescArgs.pDescriptorData); @@ -147,7 +145,7 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput if (0 == DisplayCount) { - printf("Invalid Display Count \n"); + APP_LOG_ERROR("Invalid Display Count "); goto Exit; } @@ -164,7 +162,7 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput if (FALSE == IsDisplayAttached) { - printf("Display %d is not attached, skipping the call for this display\n", DisplayIndex); + APP_LOG_WARN("Display %d is not attached, skipping the call for this display", DisplayIndex); continue; } @@ -211,13 +209,13 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); continue; } else if (DisplayCount <= 0) { - printf("Invalid Display Count. skipping display enumration for adapter:%d\n", AdapterIndex); + APP_LOG_WARN("Invalid Display Count. skipping display enumration for adapter:%d", AdapterIndex); continue; } @@ -228,7 +226,7 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("ctlEnumerateDisplayOutputs returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } @@ -238,7 +236,7 @@ ctl_result_t EnumerateTargetDisplays(uint32_t AdapterCount, ctl_device_adapter_h if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateDisplayHandles returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateDisplayHandles returned failure code: 0x%X", Result); } CTL_FREE_MEM(hDisplayOutput); @@ -280,7 +278,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } // Initialization successful @@ -292,7 +290,7 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } hDevices = (ctl_device_adapter_handle_t *)malloc(sizeof(ctl_device_adapter_handle_t) * AdapterCount); @@ -305,20 +303,20 @@ int main() } catch (const std::bad_array_new_length &e) { - printf("%s \n", e.what()); + APP_LOG_ERROR("%s ", e.what()); } Result = EnumerateTargetDisplays(AdapterCount, hDevices); if (CTL_RESULT_SUCCESS != Result) { - printf("EnumerateTargetDisplays returned failure code: 0x%X\n", Result); + APP_LOG_ERROR("EnumerateTargetDisplays returned failure code: 0x%X", Result); STORE_AND_RESET_ERROR(Result); } Exit: ctlClose(hAPIHandle); CTL_FREE_MEM(hDevices); - printf("Overrall test result is 0x%X\n", GResult); + APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; } \ No newline at end of file diff --git a/Source/cApiWrapper.cpp b/Source/cApiWrapper.cpp index ab3962d..4da89cd 100644 --- a/Source/cApiWrapper.cpp +++ b/Source/cApiWrapper.cpp @@ -1,5 +1,5 @@ //=========================================================================== -//Copyright (C) 2022-23 Intel Corporation +//Copyright (C) 2025 Intel Corporation // // // diff --git a/include/igcl_api.h b/include/igcl_api.h index 0b06871..547965f 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -1,5 +1,5 @@ //=========================================================================== -// Copyright (C) 2022-23 Intel Corporation +// Copyright (C) 2025 Intel Corporation // This software and the related documents are Intel copyrighted materials, and // your use of them is governed by the express license under which they were // provided to you ("License"). Unless the License provides otherwise, you may From 5a7edaf59c900e80a9e26d08d38b118842f57e36 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Tue, 8 Jul 2025 09:50:22 -0700 Subject: [PATCH 18/26] Updated version to v247 --- .../3D_Feature_Sample_App.cpp | 293 ++++++++++++++ Samples/FirmwareApi/FirmwareApiApp.cpp | 2 +- .../Sample_OverclockAPP.cpp | 243 ++++++------ Samples/Telemetry_Samples/README.md | 2 +- .../Telemetry_Samples/Sample_TelemetryAPP.cpp | 367 ++++++++++++++---- Samples/inc/GenericIGCLApp.h | 2 + Source/cApiWrapper.cpp | 136 +++++++ include/igcl_api.h | 160 ++++++++ 8 files changed, 1005 insertions(+), 200 deletions(-) diff --git a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp index ab38cfa..439a649 100644 --- a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp +++ b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp @@ -890,6 +890,285 @@ ctl_result_t CtlGlobalOrPerAppTest(ctl_device_adapter_handle_t hDevices) return Result; } + +/*************************************************************** + * @brief + * Method to test Frame Limit + * @param hDevices + * @return ctl_result_t + ***************************************************************/ +ctl_result_t CtlTestFrameLimit(ctl_device_adapter_handle_t hDevices) +{ + // Frame Limit Per APP GET/SET + ctl_result_t Result = CTL_RESULT_SUCCESS; + + printf("======================Frame Limit test -> Per Application settings =====================\n"); + char *pAppName = "GTA5.exe"; + ctl_3d_feature_getset_t Get3DProperty = { 0 }; + ctl_3d_feature_getset_t Set3DProperty = { 0 }; + + Set3DProperty.Size = sizeof(Set3DProperty); + Get3DProperty.Size = sizeof(Get3DProperty); + + // Set Frame Limit + Set3DProperty.FeatureType = CTL_3D_FEATURE_FRAME_LIMIT; + Set3DProperty.bSet = TRUE; + Set3DProperty.CustomValueSize = 0; + Set3DProperty.pCustomValue = NULL; + Set3DProperty.ApplicationName = pAppName; + Set3DProperty.ApplicationNameLength = (int8_t)strlen(pAppName); + Set3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_INT32; + Set3DProperty.Value.IntType.Enable = true; + Set3DProperty.Value.IntType.Value = 30; + Set3DProperty.Version = 0; + + if (NULL != hDevices) + { + Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); + printf(" Set3DProperty.Value.IntType.Enable = %d\n", Set3DProperty.Value.IntType.Enable); + printf(" Set3DProperty.Value.IntType.Value = %d\n", Set3DProperty.Value.IntType.Value); + printf(" Set3DProperty.ApplicationName = %s\n", Set3DProperty.ApplicationName); + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + + return Result; + } + else + { + printf("ctlGetSet3DFeature returned success\n"); + } + + // Get Frame Limit + Get3DProperty.FeatureType = CTL_3D_FEATURE_FRAME_LIMIT; + Get3DProperty.bSet = FALSE; + Get3DProperty.CustomValueSize = 0; + Get3DProperty.pCustomValue = NULL; + Get3DProperty.ApplicationName = pAppName; + Get3DProperty.ApplicationNameLength = (int8_t)strlen(pAppName); + Get3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_INT32; + Get3DProperty.Version = 0; + + if (NULL != hDevices) + { + Result = ctlGetSet3DFeature(hDevices, &Get3DProperty); + + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + + return Result; + } + else + { + printf("ctlGetSet3DFeature returned success\n"); + printf(" Get3DProperty.Value.IntType.Enable = %d\n", Get3DProperty.Value.IntType.Enable); + printf(" Get3DProperty.Value.IntType.Value = %d\n", Get3DProperty.Value.IntType.Value); + printf(" Get3DProperty.ApplicationName = %s\n", Get3DProperty.ApplicationName); + } + } + } + + // Frame Limit Global GET/SET + + printf("======================Frame Limit test -> Global settings======================\n"); + Get3DProperty = { 0 }; + Set3DProperty = { 0 }; + + Set3DProperty.Size = sizeof(Set3DProperty); + Get3DProperty.Size = sizeof(Get3DProperty); + + // Set Frame Limit + Set3DProperty.FeatureType = CTL_3D_FEATURE_FRAME_LIMIT; + Set3DProperty.bSet = TRUE; + Set3DProperty.CustomValueSize = 0; + Set3DProperty.pCustomValue = NULL; + Set3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_INT32; + Set3DProperty.Value.IntType.Enable = true; + Set3DProperty.Value.IntType.Value = 60; + Set3DProperty.Version = 0; + + if (NULL != hDevices) + { + Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); + printf(" Set3DProperty.Value.IntType.Enable = %d\n", Set3DProperty.Value.IntType.Enable); + printf(" Set3DProperty.Value.IntType.Value = %d\n", Set3DProperty.Value.IntType.Value); + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + + return Result; + } + else + { + printf("ctlGetSet3DFeature returned success\n"); + } + + // Get Frame Limit + Get3DProperty.FeatureType = CTL_3D_FEATURE_FRAME_LIMIT; + Get3DProperty.bSet = FALSE; + Get3DProperty.CustomValueSize = 0; + Get3DProperty.pCustomValue = NULL; + Get3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_INT32; + Get3DProperty.Version = 0; + + if (NULL != hDevices) + { + Result = ctlGetSet3DFeature(hDevices, &Get3DProperty); + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + + return Result; + } + else + { + printf("ctlGetSet3DFeature returned success\n"); + printf(" Get3DProperty.Value.IntType.Enable = %d\n", Get3DProperty.Value.IntType.Enable); + printf(" Get3DProperty.Value.IntType.Value = %d\n", Get3DProperty.Value.IntType.Value); + } + } + } + + return Result; +} + +/*************************************************************** + * @brief + * Method to test Low Latency + * @param hDevices + * @return ctl_result_t + ***************************************************************/ +ctl_result_t CtlTestLowLatency(ctl_device_adapter_handle_t hDevices) +{ + // Low Latency Per APP GET/SET + ctl_result_t Result = CTL_RESULT_SUCCESS; + + printf("======================Low Latency test -> Per Application settings =====================\n"); + char *pAppName = "GTA5.exe"; + ctl_3d_feature_getset_t Get3DProperty = { 0 }; + ctl_3d_feature_getset_t Set3DProperty = { 0 }; + + Set3DProperty.Size = sizeof(Set3DProperty); + Get3DProperty.Size = sizeof(Get3DProperty); + + // Set Low Latency mode + Set3DProperty.FeatureType = CTL_3D_FEATURE_LOW_LATENCY; + Set3DProperty.bSet = TRUE; + Set3DProperty.CustomValueSize = 0; + Set3DProperty.pCustomValue = NULL; + Set3DProperty.ApplicationName = pAppName; + Set3DProperty.ApplicationNameLength = (int8_t)strlen(pAppName); + Set3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; + Set3DProperty.Value.EnumType.EnableType = CTL_3D_LOW_LATENCY_TYPES_TURN_ON_BOOST_MODE_ON; + Set3DProperty.Version = 0; + + if (NULL != hDevices) + { + Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); + printf(" Set3DProperty.Value.EnumType.EnableType = %d\n", Set3DProperty.Value.EnumType.EnableType); + printf(" Set3DProperty.ApplicationName = %s\n", Set3DProperty.ApplicationName); + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + + return Result; + } + else + { + printf("ctlGetSet3DFeature returned success\n"); + } + + // Get Low Latency mode + Get3DProperty.FeatureType = CTL_3D_FEATURE_LOW_LATENCY; + Get3DProperty.bSet = FALSE; + Get3DProperty.CustomValueSize = 0; + Get3DProperty.pCustomValue = NULL; + Get3DProperty.ApplicationName = pAppName; + Get3DProperty.ApplicationNameLength = (int8_t)strlen(pAppName); + Get3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; + Get3DProperty.Version = 0; + + if (NULL != hDevices) + { + Result = ctlGetSet3DFeature(hDevices, &Get3DProperty); + + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + + return Result; + } + else + { + printf("ctlGetSet3DFeature returned success\n"); + printf(" Get3DProperty.Value.EnumType.EnableType = %d\n", Get3DProperty.Value.EnumType.EnableType); + printf(" Get3DProperty.ApplicationName = %s\n", Get3DProperty.ApplicationName); + } + } + } + + // Low Latency Global GET/SET + + printf("======================Low Latency test -> Global settings======================\n"); + Get3DProperty = { 0 }; + Set3DProperty = { 0 }; + + Set3DProperty.Size = sizeof(Set3DProperty); + Get3DProperty.Size = sizeof(Get3DProperty); + + // Set Low Latency mode + Set3DProperty.FeatureType = CTL_3D_FEATURE_LOW_LATENCY; + Set3DProperty.bSet = TRUE; + Set3DProperty.CustomValueSize = 0; + Set3DProperty.pCustomValue = NULL; + Set3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; + Set3DProperty.Value.EnumType.EnableType = CTL_3D_LOW_LATENCY_TYPES_TURN_ON; + Set3DProperty.Version = 0; + + if (NULL != hDevices) + { + Result = ctlGetSet3DFeature(hDevices, &Set3DProperty); + printf(" Set3DProperty.Value.EnumType.EnableType = %d\n", Set3DProperty.Value.EnumType.EnableType); + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + + return Result; + } + else + { + printf("ctlGetSet3DFeature returned success\n"); + } + + // Get Low Latency mode + Get3DProperty.FeatureType = CTL_3D_FEATURE_LOW_LATENCY; + Get3DProperty.bSet = FALSE; + Get3DProperty.CustomValueSize = 0; + Get3DProperty.pCustomValue = NULL; + Get3DProperty.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; + Get3DProperty.Version = 0; + + if (NULL != hDevices) + { + Result = ctlGetSet3DFeature(hDevices, &Get3DProperty); + if (CTL_RESULT_SUCCESS != Result) + { + printf("ctlGetSet3DFeature returned failure code: 0x%X\n", Result); + + return Result; + } + else + { + printf("ctlGetSet3DFeature returned success\n"); + printf(" Get3DProperty.Value.EnumType.EnableType = %d\n", Get3DProperty.Value.EnumType.EnableType); + } + } + } + + return Result; +} + int main() { ctl_result_t Result = CTL_RESULT_SUCCESS; @@ -1013,6 +1292,20 @@ int main() } STORE_RESET_ERROR(Result); + Result = CtlTestFrameLimit(hDevices[Index]); + if (CTL_RESULT_SUCCESS != Result) + { + APP_LOG_ERROR("CtlTestFrameLimit failure code: 0x%X", Result); + } + STORE_RESET_ERROR(Result); + + Result = CtlTestLowLatency(hDevices[Index]); + if (CTL_RESULT_SUCCESS != Result) + { + APP_LOG_ERROR("CtlTestLowLatency failure code: 0x%X", Result); + } + STORE_RESET_ERROR(Result); + // Test eventing CtlTestEvents(hDevices[0]); // for now just first adapter! } diff --git a/Samples/FirmwareApi/FirmwareApiApp.cpp b/Samples/FirmwareApi/FirmwareApiApp.cpp index e631196..4f119f4 100644 --- a/Samples/FirmwareApi/FirmwareApiApp.cpp +++ b/Samples/FirmwareApi/FirmwareApiApp.cpp @@ -190,7 +190,7 @@ int main() if (BaseFwProperties.FirmwareConfig & CTL_FIRMWARE_CONFIG_FLAG_IS_DEVICE_LINK_SPEED_DOWNGRADE_ACTIVE) { - printf("We already attempted to go to Gen5 and it probably failed, nothing else to do now"); + printf("We downgraded from Gen5 to Gen4 successfully or we already attempted to go from Gen4 to Gen5 and it probably failed\n"); continue; } } diff --git a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp index e4ec8cf..b32e200 100644 --- a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp +++ b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp @@ -37,7 +37,7 @@ void OverclockVramMemSpeedLimit(ctl_device_adapter_handle_t hDAhandle); void OverclockVFCurveReadWrite(ctl_device_adapter_handle_t hDAhandle); void OverclockPowerTelemetry(ctl_device_adapter_handle_t hDAhandle); -std::string printType(ctl_data_type_t Type) +std::string DecodeCtlDataType(ctl_data_type_t Type) { static const std::map dataTypeStringMap = { { CTL_DATA_TYPE_INT8, "INT8" }, { CTL_DATA_TYPE_UINT8, "UINT8" }, @@ -61,7 +61,7 @@ std::string printType(ctl_data_type_t Type) return "Unknown datatype"; } -std::string printUnits(ctl_units_t Units) +std::string DecodeCtlUnits(ctl_units_t Units) { static const std::map unitsStringMap = { { CTL_UNITS_FREQUENCY_MHZ, "Frequency in MHz" }, { CTL_UNITS_OPERATIONS_GTS, "GigaOperations per Second" }, @@ -87,7 +87,7 @@ std::string printUnits(ctl_units_t Units) return "Unknown unit"; } -std::string printVFCurveDetails(ctl_vf_curve_details_t VFCurveDetails) +std::string DecodeVFCurveDetails(ctl_vf_curve_details_t VFCurveDetails) { static const std::map vfCurveDetailsMap = { { CTL_VF_CURVE_DETAILS_SIMPLIFIED, "[CTL_VF_CURVE_DETAILS_SIMPLIFIED]" }, { CTL_VF_CURVE_DETAILS_MEDIUM, "[CTL_VF_CURVE_DETAILS_MEDIUM]" }, @@ -101,6 +101,11 @@ std::string printVFCurveDetails(ctl_vf_curve_details_t VFCurveDetails) return "Unknown vfcurvedetails"; } +std::string DecodeBoolean(bool Value) +{ + return Value ? "true" : "false"; +} + // Decoding the return code for the most common error codes. std::string DecodeRetCode(ctl_result_t Res) { @@ -175,75 +180,75 @@ void OverclockProperties(ctl_device_adapter_handle_t hDAhandle) } // Is Overclocking supported by this adapter? - PRINT_LOGS("\nOc Supported? %s", OcProperties.bSupported ? "true" : "false"); + PRINT_LOGS("\nOc Supported? %s", DecodeBoolean(OcProperties.bSupported).c_str()); // Slider for frequency offset - PRINT_LOGS("\nGpu Frequency Offset Supported? %s ", OcProperties.gpuFrequencyOffset.bSupported ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Is Relative? %s", OcProperties.gpuFrequencyOffset.bRelative ? "true" : "false"); - PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", OcProperties.gpuFrequencyOffset.bReference ? "true" : "false"); + PRINT_LOGS("\nGpu Frequency Offset Supported? %s ", DecodeBoolean(OcProperties.gpuFrequencyOffset.bSupported).c_str()); + PRINT_LOGS("\nGpu Frequency Offset Is Relative? %s", DecodeBoolean(OcProperties.gpuFrequencyOffset.bRelative).c_str()); + PRINT_LOGS("\nGpu Frequency Offset Have Reference? %s", DecodeBoolean(OcProperties.gpuFrequencyOffset.bReference).c_str()); PRINT_LOGS("\nGpu Frequency Offset Default: %lf", OcProperties.gpuFrequencyOffset.Default); PRINT_LOGS("\nGpu Frequency Offset Min: %lf", OcProperties.gpuFrequencyOffset.min); PRINT_LOGS("\nGpu Frequency Offset Max: %lf", OcProperties.gpuFrequencyOffset.max); PRINT_LOGS("\nGpu Frequency Offset Reference: %lf", OcProperties.gpuFrequencyOffset.reference); PRINT_LOGS("\nGpu Frequency Offset Step: %lf", OcProperties.gpuFrequencyOffset.step); - PRINT_LOGS("\nGpu Frequency Offset Units:: %s\n", printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); + PRINT_LOGS("\nGpu Frequency Offset Units:: %s\n", DecodeCtlUnits(OcProperties.gpuFrequencyOffset.units).c_str()); // Slider for voltage offset - PRINT_LOGS("\nGpu Voltage Offset Supported? %s ", OcProperties.gpuVoltageOffset.bSupported ? "true" : "false"); - PRINT_LOGS("\nGpu Voltage Offset Is Relative? %s", OcProperties.gpuVoltageOffset.bRelative ? "true" : "false"); - PRINT_LOGS("\nGpu Voltage Offset Have Reference? %s", OcProperties.gpuVoltageOffset.bReference ? "true" : "false"); + PRINT_LOGS("\nGpu Voltage Offset Supported? %s ", DecodeBoolean(OcProperties.gpuVoltageOffset.bSupported).c_str()); + PRINT_LOGS("\nGpu Voltage Offset Is Relative? %s", DecodeBoolean(OcProperties.gpuVoltageOffset.bRelative).c_str()); + PRINT_LOGS("\nGpu Voltage Offset Have Reference? %s", DecodeBoolean(OcProperties.gpuVoltageOffset.bReference).c_str()); PRINT_LOGS("\nGpu Voltage Offset Default: %lf", OcProperties.gpuVoltageOffset.Default); PRINT_LOGS("\nGpu Voltage Offset Min : %lf", OcProperties.gpuVoltageOffset.min); PRINT_LOGS("\nGpu Voltage Offset Max: %lf", OcProperties.gpuVoltageOffset.max); PRINT_LOGS("\nGpu Voltage Offset Reference: %lf", OcProperties.gpuVoltageOffset.reference); PRINT_LOGS("\nGpu Voltage Offset Step: %lf", OcProperties.gpuVoltageOffset.step); - PRINT_LOGS("\nGpu Voltage Offset Units: %s\n", printUnits(OcProperties.gpuVoltageOffset.units).c_str()); + PRINT_LOGS("\nGpu Voltage Offset Units: %s\n", DecodeCtlUnits(OcProperties.gpuVoltageOffset.units).c_str()); // Slider for VRAM Mem Speed Limit - PRINT_LOGS("\nVram Memory Speed Limit Supported? %s ", OcProperties.vramMemSpeedLimit.bSupported ? "true" : "false"); - PRINT_LOGS("\nVram Memory Speed Limit Is Relative? %s", OcProperties.vramMemSpeedLimit.bRelative ? "true" : "false"); - PRINT_LOGS("\nVram Memory Speed Limit Have Reference? %s", OcProperties.vramMemSpeedLimit.bReference ? "true" : "false"); + PRINT_LOGS("\nVram Memory Speed Limit Supported? %s ", DecodeBoolean(OcProperties.vramMemSpeedLimit.bSupported).c_str()); + PRINT_LOGS("\nVram Memory Speed Limit Is Relative? %s", DecodeBoolean(OcProperties.vramMemSpeedLimit.bRelative).c_str()); + PRINT_LOGS("\nVram Memory Speed Limit Have Reference? %s", DecodeBoolean(OcProperties.vramMemSpeedLimit.bReference).c_str()); PRINT_LOGS("\nVram Memory Speed Limit Default: %lf", OcProperties.vramMemSpeedLimit.Default); PRINT_LOGS("\nVram Memory Speed Limit Min : %lf", OcProperties.vramMemSpeedLimit.min); PRINT_LOGS("\nVram Memory Speed Limit Max: %lf", OcProperties.vramMemSpeedLimit.max); PRINT_LOGS("\nVram Memory Speed Limit Reference: %lf", OcProperties.vramMemSpeedLimit.reference); PRINT_LOGS("\nVram Memory Speed Limit Step: %lf", OcProperties.vramMemSpeedLimit.step); - PRINT_LOGS("\nVram Memory Speed Limit Units: %s\n", printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); + PRINT_LOGS("\nVram Memory Speed Limit Units: %s\n", DecodeCtlUnits(OcProperties.vramMemSpeedLimit.units).c_str()); // Slider for Power Limit - PRINT_LOGS("\nPower Limit Supported? %s ", OcProperties.powerLimit.bSupported ? "true" : "false"); - PRINT_LOGS("\nPower Limit Is Relative? %s", OcProperties.powerLimit.bRelative ? "true" : "false"); - PRINT_LOGS("\nPower Limit Have Reference? %s", OcProperties.powerLimit.bReference ? "true" : "false"); + PRINT_LOGS("\nPower Limit Supported? %s ", DecodeBoolean(OcProperties.powerLimit.bSupported).c_str()); + PRINT_LOGS("\nPower Limit Is Relative? %s", DecodeBoolean(OcProperties.powerLimit.bRelative).c_str()); + PRINT_LOGS("\nPower Limit Have Reference? %s", DecodeBoolean(OcProperties.powerLimit.bReference).c_str()); PRINT_LOGS("\nPower Limit Default: %lf", OcProperties.powerLimit.Default); PRINT_LOGS("\nPower Limit Min: %lf", OcProperties.powerLimit.min); PRINT_LOGS("\nPower Limit Max: %lf", OcProperties.powerLimit.max); PRINT_LOGS("\nPower Limit Reference: %lf", OcProperties.powerLimit.reference); PRINT_LOGS("\nPower Limit Step: %lf", OcProperties.powerLimit.step); - PRINT_LOGS("\nPower Limit Units: %s\n", printUnits(OcProperties.powerLimit.units).c_str()); + PRINT_LOGS("\nPower Limit Units: %s\n", DecodeCtlUnits(OcProperties.powerLimit.units).c_str()); // Slider for Temperature Limit - PRINT_LOGS("\nTemperature Limit Supported? %s ", OcProperties.temperatureLimit.bSupported ? "true" : "false"); - PRINT_LOGS("\nTemperature Limit Is Relative? %s", OcProperties.temperatureLimit.bRelative ? "true" : "false"); - PRINT_LOGS("\nTemperature Limit Have Reference? %s", OcProperties.temperatureLimit.bReference ? "true" : "false"); + PRINT_LOGS("\nTemperature Limit Supported? %s ", DecodeBoolean(OcProperties.temperatureLimit.bSupported).c_str()); + PRINT_LOGS("\nTemperature Limit Is Relative? %s", DecodeBoolean(OcProperties.temperatureLimit.bRelative).c_str()); + PRINT_LOGS("\nTemperature Limit Have Reference? %s", DecodeBoolean(OcProperties.temperatureLimit.bReference).c_str()); PRINT_LOGS("\nTemperature Limit Default: %lf", OcProperties.temperatureLimit.Default); PRINT_LOGS("\nTemperature Limit Min: %lf", OcProperties.temperatureLimit.min); PRINT_LOGS("\nTemperature Limit Max: %lf", OcProperties.temperatureLimit.max); PRINT_LOGS("\nTemperature Limit Reference: %lf", OcProperties.temperatureLimit.reference); PRINT_LOGS("\nTemperature Limit Step: %lf", OcProperties.temperatureLimit.step); - PRINT_LOGS("\nTemperature Limit Units: %s\n", printUnits(OcProperties.temperatureLimit.units).c_str()); + PRINT_LOGS("\nTemperature Limit Units: %s\n", DecodeCtlUnits(OcProperties.temperatureLimit.units).c_str()); // Voltage Frequency Curve Property - PRINT_LOGS("\nVF Curve R/W Supported? %s ", OcProperties.gpuVFCurveVoltageLimit.bSupported ? "true" : "false"); + PRINT_LOGS("\nVF Curve R/W Supported? %s ", DecodeBoolean(OcProperties.gpuVFCurveVoltageLimit.bSupported).c_str()); PRINT_LOGS("\nVF Curve Voltage Axis Min: %lf", OcProperties.gpuVFCurveVoltageLimit.min); PRINT_LOGS("\nVF Curve Voltage Axis Max: %lf", OcProperties.gpuVFCurveVoltageLimit.max); PRINT_LOGS("\nVF Curve Voltage Axis Step: %lf", OcProperties.gpuVFCurveVoltageLimit.step); - PRINT_LOGS("\nVF Curve Voltage Axis Units: %s\n", printUnits(OcProperties.gpuVFCurveVoltageLimit.units).c_str()); + PRINT_LOGS("\nVF Curve Voltage Axis Units: %s\n", DecodeCtlUnits(OcProperties.gpuVFCurveVoltageLimit.units).c_str()); - PRINT_LOGS("\nVF Curve R/W Supported? %s ", OcProperties.gpuVFCurveFrequencyLimit.bSupported ? "true" : "false"); + PRINT_LOGS("\nVF Curve R/W Supported? %s ", DecodeBoolean(OcProperties.gpuVFCurveFrequencyLimit.bSupported).c_str()); PRINT_LOGS("\nVF Curve Freq Axis Min: %lf", OcProperties.gpuVFCurveFrequencyLimit.min); PRINT_LOGS("\nVF Curve Freq Axis Max: %lf", OcProperties.gpuVFCurveFrequencyLimit.max); PRINT_LOGS("\nVF Curve Freq Axis Step: %lf", OcProperties.gpuVFCurveFrequencyLimit.step); - PRINT_LOGS("\nVF Curve Freq Axis Units: %s", printUnits(OcProperties.gpuVFCurveFrequencyLimit.units).c_str()); + PRINT_LOGS("\nVF Curve Freq Axis Units: %s", DecodeCtlUnits(OcProperties.gpuVFCurveFrequencyLimit.units).c_str()); } /*************************************************************** @@ -277,7 +282,7 @@ void OverclockFrequencyOffset(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockFrequencyOffset => ctlOverclockGpuFrequencyOffsetGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\n\nCurrent Frequency Offset: %lf, %s", GPUFrequencyOffset, printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); + PRINT_LOGS("\n\nCurrent Frequency Offset: %lf, %s", GPUFrequencyOffset, DecodeCtlUnits(OcProperties.gpuFrequencyOffset.units).c_str()); // Step 3: Writing New Frequency Offset by increasing it by (Step * 5.0) MHz from min value // Input Frequency Offset units are given in ctl_oc_properties_t::gpuFrequencyOffset::units returned from ctlOverclockGetProperties() @@ -289,7 +294,7 @@ void OverclockFrequencyOffset(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockFrequencyOffset => ctlOverclockGpuFrequencyOffsetSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nSetting New Frequency Offset: %lf, %s", GPUFrequencyOffset, printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); + PRINT_LOGS("\nSetting New Frequency Offset: %lf, %s", GPUFrequencyOffset, DecodeCtlUnits(OcProperties.gpuFrequencyOffset.units).c_str()); // Step 4: Reading back New Frequency Offset // Output Frequency Offset units are returned in ctl_oc_properties_t::gpuFrequencyOffset::units returned from ctlOverclockGetProperties() @@ -300,7 +305,7 @@ void OverclockFrequencyOffset(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockFrequencyOffset => ctlOverclockGpuFrequencyOffsetGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nReading New Frequency Offset: %lf, %s", GPUFrequencyOffset, printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); + PRINT_LOGS("\nReading New Frequency Offset: %lf, %s", GPUFrequencyOffset, DecodeCtlUnits(OcProperties.gpuFrequencyOffset.units).c_str()); // Step 5: Resetting Frequency Offset // Input Frequency Offset units are given in ctl_oc_properties_t::gpuFrequencyOffset::units returned from ctlOverclockGetProperties() @@ -312,7 +317,7 @@ void OverclockFrequencyOffset(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockFrequencyOffset => ctlOverclockGpuFrequencyOffsetSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nResetting Frequency Offset to Default Value: %lf, %s", GPUFrequencyOffset, printUnits(OcProperties.gpuFrequencyOffset.units).c_str()); + PRINT_LOGS("\nResetting Frequency Offset to Default Value: %lf, %s", GPUFrequencyOffset, DecodeCtlUnits(OcProperties.gpuFrequencyOffset.units).c_str()); } /*************************************************************** @@ -346,7 +351,7 @@ void OverclockVoltageOffset(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockGpuMaxVoltageOffsetGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\n\nCurrent Voltage Offset: %lf, %s", VoltageOffset, printUnits(OcProperties.gpuVoltageOffset.units).c_str()); + PRINT_LOGS("\n\nCurrent Voltage Offset: %lf, %s", VoltageOffset, DecodeCtlUnits(OcProperties.gpuVoltageOffset.units).c_str()); // Step 3: Calling Waiver Set first before writing the Voltage Offset Status = ctlOverclockWaiverSet(hDAhandle); @@ -367,7 +372,7 @@ void OverclockVoltageOffset(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockGpuMaxVoltageOffsetSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nSetting New Voltage Offset: %lf, %s", VoltageOffset, printUnits(OcProperties.gpuVoltageOffset.units).c_str()); + PRINT_LOGS("\nSetting New Voltage Offset: %lf, %s", VoltageOffset, DecodeCtlUnits(OcProperties.gpuVoltageOffset.units).c_str()); // Step 5: Reading back New Voltage Offset // Output Voltage Offset units are returned in ctl_oc_properties_t::gpuVoltageOffset::units returned from ctlOverclockGetProperties() @@ -378,7 +383,7 @@ void OverclockVoltageOffset(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockGpuMaxVoltageOffsetGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nReading New Voltage Offset: %lf %s", VoltageOffset, printUnits(OcProperties.gpuVoltageOffset.units).c_str()); + PRINT_LOGS("\nReading New Voltage Offset: %lf %s", VoltageOffset, DecodeCtlUnits(OcProperties.gpuVoltageOffset.units).c_str()); // Step 6: Resetting Voltage Offset // Input Voltage Offset units are given in ctl_oc_properties_t::gpuVoltageOffset::units returned from ctlOverclockGetProperties() @@ -390,7 +395,7 @@ void OverclockVoltageOffset(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockVoltageOffset => ctlOverclockGpuMaxVoltageOffsetSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nResetting Voltage Offset to Default Value: %lf, %s", VoltageOffset, printUnits(OcProperties.gpuVoltageOffset.units).c_str()); + PRINT_LOGS("\nResetting Voltage Offset to Default Value: %lf, %s", VoltageOffset, DecodeCtlUnits(OcProperties.gpuVoltageOffset.units).c_str()); } /*************************************************************** @@ -502,7 +507,7 @@ void OverclockPowerLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockPowerLimit => ctlOverclockPowerLimitGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\n\nCurrent Sustained Power Limit: %lf, %s", CurrentPowerLimit, printUnits(OcProperties.powerLimit.units).c_str()); + PRINT_LOGS("\n\nCurrent Sustained Power Limit: %lf, %s", CurrentPowerLimit, DecodeCtlUnits(OcProperties.powerLimit.units).c_str()); // Step 3: Writing New Sustained Power Limit by increasing it by (Step * 5.0) from min value // Input Sustained Power Limit units are given in ctl_oc_properties_t::powerLimit::units returned from ctlOverclockGetProperties() @@ -514,7 +519,7 @@ void OverclockPowerLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockPowerLimit => ctlOverclockPowerLimitSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nSetting New Sustained Power Limit: %lf, %s", CurrentPowerLimit, printUnits(OcProperties.powerLimit.units).c_str()); + PRINT_LOGS("\nSetting New Sustained Power Limit: %lf, %s", CurrentPowerLimit, DecodeCtlUnits(OcProperties.powerLimit.units).c_str()); // Step 4: Reading back New Sustained Power Limit // Output Sustained Power Limit units are returned in ctl_oc_properties_t::powerLimit::units returned from ctlOverclockGetProperties() @@ -525,7 +530,7 @@ void OverclockPowerLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockPowerLimit => ctlOverclockPowerLimitGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nReading New Sustained Power Limit: %lf, %s", CurrentPowerLimit, printUnits(OcProperties.powerLimit.units).c_str()); + PRINT_LOGS("\nReading New Sustained Power Limit: %lf, %s", CurrentPowerLimit, DecodeCtlUnits(OcProperties.powerLimit.units).c_str()); // Step 5: Resetting Sustained Power Limit // Input Sustained Power Limit units are given in ctl_oc_properties_t::powerLimit::units returned from ctlOverclockGetProperties() @@ -537,7 +542,7 @@ void OverclockPowerLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockPowerLimit => ctlOverclockPowerLimitSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nResetting Sustained Power Limit to Default Value: %lf %s", CurrentPowerLimit, printUnits(OcProperties.powerLimit.units).c_str()); + PRINT_LOGS("\nResetting Sustained Power Limit to Default Value: %lf %s", CurrentPowerLimit, DecodeCtlUnits(OcProperties.powerLimit.units).c_str()); } /*************************************************************** @@ -573,7 +578,7 @@ void OverclockTemperatureLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockTemperatureLimit => ctlOverclockTemperatureLimitGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\n\nCurrent Temperature Limit: %lf, %s", CurrentTemperatureLimit, printUnits(OcProperties.temperatureLimit.units).c_str()); + PRINT_LOGS("\n\nCurrent Temperature Limit: %lf, %s", CurrentTemperatureLimit, DecodeCtlUnits(OcProperties.temperatureLimit.units).c_str()); // Step 3: Writing New Temperature Limit by increasing it by (Step * 5.0) from min value // Input Temperature Limit units are given in ctl_oc_properties_t::temperatureLimit::units returned from ctlOverclockGetProperties() @@ -585,7 +590,7 @@ void OverclockTemperatureLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockTemperatureLimit => ctlOverclockTemperatureLimitSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nSetting New Temperature Limit: %lf, %s", CurrentTemperatureLimit, printUnits(OcProperties.temperatureLimit.units).c_str()); + PRINT_LOGS("\nSetting New Temperature Limit: %lf, %s", CurrentTemperatureLimit, DecodeCtlUnits(OcProperties.temperatureLimit.units).c_str()); // Step 4: Reading back New Temperature Limit // Output Temperature Limit units are returned in ctl_oc_properties_t::temperatureLimit::units returned from ctlOverclockGetProperties() @@ -596,7 +601,7 @@ void OverclockTemperatureLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockTemperatureLimit => ctlOverclockTemperatureLimitGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nReading New Temperature Limit: %lf, %s", CurrentTemperatureLimit, printUnits(OcProperties.temperatureLimit.units).c_str()); + PRINT_LOGS("\nReading New Temperature Limit: %lf, %s", CurrentTemperatureLimit, DecodeCtlUnits(OcProperties.temperatureLimit.units).c_str()); // Step 5: Resetting Temperature Limit // Input Temperature Limit units are given in ctl_oc_properties_t::temperatureLimit::units returned from ctlOverclockGetProperties() @@ -608,7 +613,7 @@ void OverclockTemperatureLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockTemperatureLimit => ctlOverclockTemperatureLimitSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nResetting Temperature Limit to Default Value: %lf, %s", CurrentTemperatureLimit, printUnits(OcProperties.temperatureLimit.units).c_str()); + PRINT_LOGS("\nResetting Temperature Limit to Default Value: %lf, %s", CurrentTemperatureLimit, DecodeCtlUnits(OcProperties.temperatureLimit.units).c_str()); } /*************************************************************** @@ -643,7 +648,7 @@ void OverclockVramMemSpeedLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockVramMemSpeedLimit => ctlOverclockVramMemSpeedLimitGetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\n\nCurrent VramMemSpeed Limit: %lf, %s", CurrentVramMemSpeedLimit, printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); + PRINT_LOGS("\n\nCurrent VramMemSpeed Limit: %lf, %s", CurrentVramMemSpeedLimit, DecodeCtlUnits(OcProperties.vramMemSpeedLimit.units).c_str()); // Step 3: Writing New VramMemSpeed Limit by increasing it by (Step * 5.0) Gbps from min value // Input VramMemSpeed Limit units are given in ctl_oc_properties_t::vramMemSpeedLimit::units returned from ctlOverclockGetProperties() @@ -655,7 +660,7 @@ void OverclockVramMemSpeedLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockVramMemSpeedLimit => ctlOverclockVramMemSpeedLimitSetV2 Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nSetting New VramMemSpeed Limit: %lf, %s", CurrentVramMemSpeedLimit, printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); + PRINT_LOGS("\nSetting New VramMemSpeed Limit: %lf, %s", CurrentVramMemSpeedLimit, DecodeCtlUnits(OcProperties.vramMemSpeedLimit.units).c_str()); // Step 4: Reading back New VramMemSpeed Limit // Output VramMemSpeed Limit units are returned in ctl_oc_properties_t::vramMemSpeedLimit::units returned from ctlOverclockGetProperties() @@ -666,7 +671,7 @@ void OverclockVramMemSpeedLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockVramMemSpeedLimit => ctlOverclockVramMemSpeedLimitGetV2 after setting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nReading New VramMemSpeed Limit: %lf, %s", CurrentVramMemSpeedLimit, printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); + PRINT_LOGS("\nReading New VramMemSpeed Limit: %lf, %s", CurrentVramMemSpeedLimit, DecodeCtlUnits(OcProperties.vramMemSpeedLimit.units).c_str()); // Step 5: Resetting VramMemSpeed Limit // Input VramMemSpeed Limit units are given in ctl_oc_properties_t::vramMemSpeedLimit::units returned from ctlOverclockGetProperties() @@ -678,7 +683,7 @@ void OverclockVramMemSpeedLimit(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\nOverclockVramMemSpeedLimit => ctlOverclockVramMemSpeedLimitSetV2 after resetting, Result: Error %s, ErrorCode: 0x%x", DecodeRetCode(Status).c_str(), Status); return; } - PRINT_LOGS("\nResetting VramMemSpeed Limit to Default Value: %lf, %s", CurrentVramMemSpeedLimit, printUnits(OcProperties.vramMemSpeedLimit.units).c_str()); + PRINT_LOGS("\nResetting VramMemSpeed Limit to Default Value: %lf, %s", CurrentVramMemSpeedLimit, DecodeCtlUnits(OcProperties.vramMemSpeedLimit.units).c_str()); } /*************************************************************** @@ -709,13 +714,13 @@ void OverclockVFCurveReadWrite(ctl_device_adapter_handle_t hDAhandle) Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, nullptr); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, Error: %s, ErrorCode: 0x%x", DecodeVFCurveDetails(VFCurveDetails).c_str(), DecodeRetCode(Status).c_str(), Status); return; } else { - PRINT_LOGS("\n\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, NumVFPoints: %lu", printVFCurveDetails(VFCurveDetails).c_str(), NumVFPoints); + PRINT_LOGS("\n\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, NumVFPoints: %lu", DecodeVFCurveDetails(VFCurveDetails).c_str(), NumVFPoints); pVFCurveTable = (ctl_voltage_frequency_point_t *)malloc(sizeof(ctl_voltage_frequency_point_t) * NumVFPoints); if (pVFCurveTable == NULL) @@ -727,14 +732,14 @@ void OverclockVFCurveReadWrite(ctl_device_adapter_handle_t hDAhandle) Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, pVFCurveTable); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, Error: %s, ErrorCode: 0x%x", DecodeVFCurveDetails(VFCurveDetails).c_str(), DecodeRetCode(Status).c_str(), Status); free(pVFCurveTable); goto Exit; } for (uint32_t i = 0; i < NumVFPoints; i++) { - PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), i, + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", DecodeVFCurveDetails(VFCurveDetails).c_str(), i, pVFCurveTable[i].Frequency, pVFCurveTable[i].Voltage); } free(pVFCurveTable); @@ -758,13 +763,13 @@ void OverclockVFCurveReadWrite(ctl_device_adapter_handle_t hDAhandle) Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, nullptr); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, Error: %s, ErrorCode: 0x%x", DecodeVFCurveDetails(VFCurveDetails).c_str(), DecodeRetCode(Status).c_str(), Status); return; } else { - PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, NumVFPoints: %lu", printVFCurveDetails(VFCurveDetails).c_str(), NumVFPoints); + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 1, NumVFPoints: %lu", DecodeVFCurveDetails(VFCurveDetails).c_str(), NumVFPoints); pVFCurveTable = (ctl_voltage_frequency_point_t *)malloc(sizeof(ctl_voltage_frequency_point_t) * NumVFPoints); if (pVFCurveTable == NULL) @@ -776,29 +781,29 @@ void OverclockVFCurveReadWrite(ctl_device_adapter_handle_t hDAhandle) Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, pVFCurveTable); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, Error: %s, ErrorCode: 0x%x", DecodeVFCurveDetails(VFCurveDetails).c_str(), DecodeRetCode(Status).c_str(), Status); free(pVFCurveTable); goto Exit; } - PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, Before modifying VFPoint 5, VFPoint 6", printVFCurveDetails(VFCurveDetails).c_str()); - PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), 5, + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, Before modifying VFPoint 5, VFPoint 6", DecodeVFCurveDetails(VFCurveDetails).c_str()); + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", DecodeVFCurveDetails(VFCurveDetails).c_str(), 5, pVFCurveTable[5].Frequency, pVFCurveTable[5].Voltage); - PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), 6, + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", DecodeVFCurveDetails(VFCurveDetails).c_str(), 6, pVFCurveTable[6].Frequency, pVFCurveTable[6].Voltage); pVFCurveTable[5].Frequency += 50; pVFCurveTable[6].Frequency += 100; - PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, After modifying VFPoint 5, VFPoint 6", printVFCurveDetails(VFCurveDetails).c_str()); - PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), 5, + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, After modifying VFPoint 5, VFPoint 6", DecodeVFCurveDetails(VFCurveDetails).c_str()); + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", DecodeVFCurveDetails(VFCurveDetails).c_str(), 5, pVFCurveTable[5].Frequency, pVFCurveTable[5].Voltage); - PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), 6, + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", DecodeVFCurveDetails(VFCurveDetails).c_str(), 6, pVFCurveTable[6].Frequency, pVFCurveTable[6].Voltage); Status = ctlOverclockWriteCustomVFCurve(hDAhandle, NumVFPoints, pVFCurveTable); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockWriteCustomVFCurve, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_STOCK, %s, ctlOverclockWriteCustomVFCurve, Error: %s, ErrorCode: 0x%x", DecodeVFCurveDetails(VFCurveDetails).c_str(), DecodeRetCode(Status).c_str(), Status); free(pVFCurveTable); goto Exit; @@ -816,13 +821,13 @@ void OverclockVFCurveReadWrite(ctl_device_adapter_handle_t hDAhandle) Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, nullptr); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 1, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 1, Error: %s, ErrorCode: 0x%x", DecodeVFCurveDetails(VFCurveDetails).c_str(), DecodeRetCode(Status).c_str(), Status); return; } else { - PRINT_LOGS("\n\nCTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 1, NumVFPoints: %lu", printVFCurveDetails(VFCurveDetails).c_str(), NumVFPoints); + PRINT_LOGS("\n\nCTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 1, NumVFPoints: %lu", DecodeVFCurveDetails(VFCurveDetails).c_str(), NumVFPoints); pVFCurveTable = (ctl_voltage_frequency_point_t *)malloc(sizeof(ctl_voltage_frequency_point_t) * NumVFPoints); if (pVFCurveTable == NULL) @@ -834,14 +839,14 @@ void OverclockVFCurveReadWrite(ctl_device_adapter_handle_t hDAhandle) Status = ctlOverclockReadVFCurve(hDAhandle, VFCurveType, VFCurveDetails, &NumVFPoints, pVFCurveTable); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) { - PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 2, Error: %s, ErrorCode: 0x%x", printVFCurveDetails(VFCurveDetails).c_str(), + PRINT_LOGS("\nOverclockVFCurveReadWrite => CTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 2, Error: %s, ErrorCode: 0x%x", DecodeVFCurveDetails(VFCurveDetails).c_str(), DecodeRetCode(Status).c_str(), Status); free(pVFCurveTable); goto Exit; } for (uint32_t i = 0; i < NumVFPoints; i++) { - PRINT_LOGS("\nCTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", printVFCurveDetails(VFCurveDetails).c_str(), i, + PRINT_LOGS("\nCTL_VF_CURVE_TYPE_LIVE, %s, ctlOverclockReadVFCurve Pass 2, VFPoint: %lu, Frequency: %lu, Voltage: %lu", DecodeVFCurveDetails(VFCurveDetails).c_str(), i, pVFCurveTable[i].Frequency, pVFCurveTable[i].Voltage); } free(pVFCurveTable); @@ -885,168 +890,168 @@ void OverclockPowerTelemetry(ctl_device_adapter_handle_t hDAhandle) if (pPowerTelemetry.timeStamp.bSupported) { - PRINT_LOGS("\nTimeStamp: %f (%s) Datatype:(%s)", pPowerTelemetry.timeStamp.value.datadouble, printUnits(pPowerTelemetry.timeStamp.units).c_str(), - printType(pPowerTelemetry.timeStamp.type).c_str()); + PRINT_LOGS("\nTimeStamp: %f (%s) Datatype:(%s)", pPowerTelemetry.timeStamp.value.datadouble, DecodeCtlUnits(pPowerTelemetry.timeStamp.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.timeStamp.type).c_str()); } if (pPowerTelemetry.gpuEnergyCounter.bSupported) { - PRINT_LOGS("\nGpu Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.gpuEnergyCounter.units).c_str(), - printType(pPowerTelemetry.gpuEnergyCounter.type).c_str()); + PRINT_LOGS("\nGpu Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEnergyCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuEnergyCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuEnergyCounter.type).c_str()); } if (pPowerTelemetry.vramEnergyCounter.bSupported) { - PRINT_LOGS("\nVRAM Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.vramEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.vramEnergyCounter.units).c_str(), - printType(pPowerTelemetry.vramEnergyCounter.type).c_str()); + PRINT_LOGS("\nVRAM Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.vramEnergyCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramEnergyCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramEnergyCounter.type).c_str()); } if (pPowerTelemetry.totalCardEnergyCounter.bSupported) { - PRINT_LOGS("\nCard Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.totalCardEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.totalCardEnergyCounter.units).c_str(), - printType(pPowerTelemetry.totalCardEnergyCounter.type).c_str()); + PRINT_LOGS("\nCard Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.totalCardEnergyCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.totalCardEnergyCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.totalCardEnergyCounter.type).c_str()); } if (pPowerTelemetry.gpuVoltage.bSupported) { - PRINT_LOGS("\nGpu Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVoltage.value.datadouble, printUnits(pPowerTelemetry.gpuVoltage.units).c_str(), - printType(pPowerTelemetry.gpuVoltage.type).c_str()); + PRINT_LOGS("\nGpu Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVoltage.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuVoltage.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuVoltage.type).c_str()); } if (pPowerTelemetry.gpuCurrentClockFrequency.bSupported) { - PRINT_LOGS("\nGpu Current Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentClockFrequency.value.datadouble, printUnits(pPowerTelemetry.gpuCurrentClockFrequency.units).c_str(), - printType(pPowerTelemetry.gpuCurrentClockFrequency.type).c_str()); + PRINT_LOGS("\nGpu Current Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentClockFrequency.value.datadouble, + DecodeCtlUnits(pPowerTelemetry.gpuCurrentClockFrequency.units).c_str(), DecodeCtlDataType(pPowerTelemetry.gpuCurrentClockFrequency.type).c_str()); } if (pPowerTelemetry.gpuCurrentTemperature.bSupported) { - PRINT_LOGS("\nGpu Current Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentTemperature.value.datadouble, printUnits(pPowerTelemetry.gpuCurrentTemperature.units).c_str(), - printType(pPowerTelemetry.gpuCurrentTemperature.type).c_str()); + PRINT_LOGS("\nGpu Current Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentTemperature.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuCurrentTemperature.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuCurrentTemperature.type).c_str()); } if (pPowerTelemetry.globalActivityCounter.bSupported) { - PRINT_LOGS("\nGpu Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.globalActivityCounter.value.datadouble, printUnits(pPowerTelemetry.globalActivityCounter.units).c_str(), - printType(pPowerTelemetry.globalActivityCounter.type).c_str()); + PRINT_LOGS("\nGpu Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.globalActivityCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.globalActivityCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.globalActivityCounter.type).c_str()); } if (pPowerTelemetry.renderComputeActivityCounter.bSupported) { PRINT_LOGS("\nRender Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.renderComputeActivityCounter.value.datadouble, - printUnits(pPowerTelemetry.renderComputeActivityCounter.units).c_str(), printType(pPowerTelemetry.renderComputeActivityCounter.type).c_str()); + DecodeCtlUnits(pPowerTelemetry.renderComputeActivityCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.renderComputeActivityCounter.type).c_str()); } if (pPowerTelemetry.mediaActivityCounter.bSupported) { - PRINT_LOGS("\nMedia Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.mediaActivityCounter.value.datadouble, printUnits(pPowerTelemetry.mediaActivityCounter.units).c_str(), - printType(pPowerTelemetry.mediaActivityCounter.type).c_str()); + PRINT_LOGS("\nMedia Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.mediaActivityCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.mediaActivityCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.mediaActivityCounter.type).c_str()); } if (pPowerTelemetry.vramVoltage.bSupported) { - PRINT_LOGS("\nVRAM Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVoltage.value.datadouble, printUnits(pPowerTelemetry.vramVoltage.units).c_str(), - printType(pPowerTelemetry.vramVoltage.type).c_str()); + PRINT_LOGS("\nVRAM Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVoltage.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramVoltage.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramVoltage.type).c_str()); } if (pPowerTelemetry.vramCurrentClockFrequency.bSupported) { - PRINT_LOGS("\nVRAM Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentClockFrequency.value.datadouble, printUnits(pPowerTelemetry.vramCurrentClockFrequency.units).c_str(), - printType(pPowerTelemetry.vramCurrentClockFrequency.type).c_str()); + PRINT_LOGS("\nVRAM Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentClockFrequency.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramCurrentClockFrequency.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramCurrentClockFrequency.type).c_str()); } if (pPowerTelemetry.vramReadBandwidthCounter.bSupported) { PRINT_LOGS("\nVRAM Read Bandwidth Counter: %llu (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidthCounter.value.datau64, - printUnits(pPowerTelemetry.vramReadBandwidthCounter.units).c_str(), printType(pPowerTelemetry.vramReadBandwidthCounter.type).c_str()); + DecodeCtlUnits(pPowerTelemetry.vramReadBandwidthCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.vramReadBandwidthCounter.type).c_str()); } if (pPowerTelemetry.vramWriteBandwidthCounter.bSupported) { PRINT_LOGS("\nVRAM Write Bandwidth Counter: %llu (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidthCounter.value.datau64, - printUnits(pPowerTelemetry.vramWriteBandwidthCounter.units).c_str(), printType(pPowerTelemetry.vramWriteBandwidthCounter.type).c_str()); + DecodeCtlUnits(pPowerTelemetry.vramWriteBandwidthCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.vramWriteBandwidthCounter.type).c_str()); } if (pPowerTelemetry.vramCurrentEffectiveFrequency.bSupported) { PRINT_LOGS("\nVRAM Effective Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentEffectiveFrequency.value.datadouble, - printUnits(pPowerTelemetry.vramCurrentEffectiveFrequency.units).c_str(), printType(pPowerTelemetry.vramCurrentEffectiveFrequency.type).c_str()); + DecodeCtlUnits(pPowerTelemetry.vramCurrentEffectiveFrequency.units).c_str(), DecodeCtlDataType(pPowerTelemetry.vramCurrentEffectiveFrequency.type).c_str()); } if (pPowerTelemetry.vramCurrentTemperature.bSupported) { - PRINT_LOGS("\nVRAM Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentTemperature.value.datadouble, printUnits(pPowerTelemetry.vramCurrentTemperature.units).c_str(), - printType(pPowerTelemetry.vramCurrentTemperature.type).c_str()); + PRINT_LOGS("\nVRAM Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentTemperature.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramCurrentTemperature.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramCurrentTemperature.type).c_str()); } if (pPowerTelemetry.vramReadBandwidth.bSupported) { - PRINT_LOGS("\nVRAM Read Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidth.value.datadouble, printUnits(pPowerTelemetry.vramReadBandwidth.units).c_str(), - printType(pPowerTelemetry.vramReadBandwidth.type).c_str()); + PRINT_LOGS("\nVRAM Read Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidth.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramReadBandwidth.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramReadBandwidth.type).c_str()); } if (pPowerTelemetry.vramWriteBandwidth.bSupported) { - PRINT_LOGS("\nVRAM Write Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidth.value.datadouble, printUnits(pPowerTelemetry.vramWriteBandwidth.units).c_str(), - printType(pPowerTelemetry.vramWriteBandwidth.type).c_str()); + PRINT_LOGS("\nVRAM Write Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidth.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramWriteBandwidth.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramWriteBandwidth.type).c_str()); } if (pPowerTelemetry.gpuVrTemp.bSupported) { - PRINT_LOGS("\nGPU VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVrTemp.value.datadouble, printUnits(pPowerTelemetry.gpuVrTemp.units).c_str(), - printType(pPowerTelemetry.gpuVrTemp.type).c_str()); + PRINT_LOGS("\nGPU VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVrTemp.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuVrTemp.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuVrTemp.type).c_str()); } if (pPowerTelemetry.vramVrTemp.bSupported) { - PRINT_LOGS("\nVRAM VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVrTemp.value.datadouble, printUnits(pPowerTelemetry.vramVrTemp.units).c_str(), - printType(pPowerTelemetry.vramVrTemp.type).c_str()); + PRINT_LOGS("\nVRAM VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVrTemp.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramVrTemp.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramVrTemp.type).c_str()); } if (pPowerTelemetry.saVrTemp.bSupported) { - PRINT_LOGS("\nSA VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.saVrTemp.value.datadouble, printUnits(pPowerTelemetry.saVrTemp.units).c_str(), - printType(pPowerTelemetry.saVrTemp.type).c_str()); + PRINT_LOGS("\nSA VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.saVrTemp.value.datadouble, DecodeCtlUnits(pPowerTelemetry.saVrTemp.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.saVrTemp.type).c_str()); } if (pPowerTelemetry.gpuEffectiveClock.bSupported) { - PRINT_LOGS("\nEffective frequency of the GPU: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEffectiveClock.value.datadouble, printUnits(pPowerTelemetry.gpuEffectiveClock.units).c_str(), - printType(pPowerTelemetry.gpuEffectiveClock.type).c_str()); + PRINT_LOGS("\nEffective frequency of the GPU: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEffectiveClock.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuEffectiveClock.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuEffectiveClock.type).c_str()); } if (pPowerTelemetry.gpuOverVoltagePercent.bSupported) { - PRINT_LOGS("\nGPU Overvoltage Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuOverVoltagePercent.value.datadouble, printUnits(pPowerTelemetry.gpuOverVoltagePercent.units).c_str(), - printType(pPowerTelemetry.gpuOverVoltagePercent.type).c_str()); + PRINT_LOGS("\nGPU Overvoltage Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuOverVoltagePercent.value.datadouble, + DecodeCtlUnits(pPowerTelemetry.gpuOverVoltagePercent.units).c_str(), DecodeCtlDataType(pPowerTelemetry.gpuOverVoltagePercent.type).c_str()); } if (pPowerTelemetry.gpuPowerPercent.bSupported) { - PRINT_LOGS("\nGPU Power Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuPowerPercent.value.datadouble, printUnits(pPowerTelemetry.gpuPowerPercent.units).c_str(), - printType(pPowerTelemetry.gpuPowerPercent.type).c_str()); + PRINT_LOGS("\nGPU Power Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuPowerPercent.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuPowerPercent.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuPowerPercent.type).c_str()); } if (pPowerTelemetry.gpuTemperaturePercent.bSupported) { - PRINT_LOGS("\nGPU Temperature Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuTemperaturePercent.value.datadouble, printUnits(pPowerTelemetry.gpuTemperaturePercent.units).c_str(), - printType(pPowerTelemetry.gpuTemperaturePercent.type).c_str()); + PRINT_LOGS("\nGPU Temperature Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuTemperaturePercent.value.datadouble, + DecodeCtlUnits(pPowerTelemetry.gpuTemperaturePercent.units).c_str(), DecodeCtlDataType(pPowerTelemetry.gpuTemperaturePercent.type).c_str()); } for (int i = 0; i < CTL_FAN_COUNT; i++) { if (pPowerTelemetry.fanSpeed[i].bSupported) { - PRINT_LOGS("\nFan[%d] Speed: %f (%s) Datatype:(%s)", i, pPowerTelemetry.fanSpeed[i].value.datadouble, printUnits(pPowerTelemetry.fanSpeed[i].units).c_str(), - printType(pPowerTelemetry.fanSpeed[i].type).c_str()); + PRINT_LOGS("\nFan[%d] Speed: %f (%s) Datatype:(%s)", i, pPowerTelemetry.fanSpeed[i].value.datadouble, DecodeCtlUnits(pPowerTelemetry.fanSpeed[i].units).c_str(), + DecodeCtlDataType(pPowerTelemetry.fanSpeed[i].type).c_str()); } } - PRINT_LOGS("\ngpuPowerLimited: %s", ((pPowerTelemetry.gpuPowerLimited) ? "true" : "false")); - PRINT_LOGS("\ngpuTemperatureLimited: %s", ((pPowerTelemetry.gpuTemperatureLimited) ? "true" : "false")); - PRINT_LOGS("\ngpuCurrentLimited: %s", ((pPowerTelemetry.gpuCurrentLimited) ? "true" : "false")); - PRINT_LOGS("\ngpuVoltageLimited: %s", ((pPowerTelemetry.gpuVoltageLimited) ? "true" : "false")); - PRINT_LOGS("\ngpuUtilizationLimited: %s", ((pPowerTelemetry.gpuUtilizationLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuPowerLimited: %s", DecodeBoolean(pPowerTelemetry.gpuPowerLimited).c_str()); + PRINT_LOGS("\ngpuTemperatureLimited: %s", DecodeBoolean(pPowerTelemetry.gpuTemperatureLimited).c_str()); + PRINT_LOGS("\ngpuCurrentLimited: %s", DecodeBoolean(pPowerTelemetry.gpuCurrentLimited).c_str()); + PRINT_LOGS("\ngpuVoltageLimited: %s", DecodeBoolean(pPowerTelemetry.gpuVoltageLimited).c_str()); + PRINT_LOGS("\ngpuUtilizationLimited: %s", DecodeBoolean(pPowerTelemetry.gpuUtilizationLimited).c_str()); } else { diff --git a/Samples/Telemetry_Samples/README.md b/Samples/Telemetry_Samples/README.md index da2c0ba..c7dea1d 100644 --- a/Samples/Telemetry_Samples/README.md +++ b/Samples/Telemetry_Samples/README.md @@ -1 +1 @@ -Sample Application for the Telemetry interface \ No newline at end of file +Sample Application for the Telemetry interface. \ No newline at end of file diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index dc9739b..32aef44 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -36,9 +36,10 @@ void CtlPciTest(ctl_device_adapter_handle_t hDAhandle); void CtlMemoryTest(ctl_device_adapter_handle_t hDAhandle); void CtlEngineTest(ctl_device_adapter_handle_t hDAhandle); void CtlLedTest(ctl_device_adapter_handle_t hDAhandle); +void CtlEccTest(ctl_device_adapter_handle_t hDAhandle); void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle); -std::string printType(ctl_data_type_t Type) +std::string DecodeCtlDataType(ctl_data_type_t Type) { static const std::map dataTypeStringMap = { { CTL_DATA_TYPE_INT8, "INT8" }, { CTL_DATA_TYPE_UINT8, "UINT8" }, @@ -62,7 +63,7 @@ std::string printType(ctl_data_type_t Type) return "Unknown datatype"; } -std::string printUnits(ctl_units_t Units) +std::string DecodeCtlUnits(ctl_units_t Units) { static const std::map unitsStringMap = { { CTL_UNITS_FREQUENCY_MHZ, "Frequency in MHz" }, { CTL_UNITS_OPERATIONS_GTS, "GigaOperations per Second" }, @@ -88,6 +89,87 @@ std::string printUnits(ctl_units_t Units) return "Unknown unit"; } +std::string DecodeTemperatureSensor(ctl_temp_sensors_t tempSensor) +{ + static const std::map tempSensorStringMap = { { CTL_TEMP_SENSORS_GLOBAL, "GLOBAL" }, { CTL_TEMP_SENSORS_GPU, "GPU" }, { CTL_TEMP_SENSORS_MEMORY, "MEMORY" } }; + + auto it = tempSensorStringMap.find(tempSensor); + if (it != tempSensorStringMap.end()) + { + return it->second; + } + return "Unknown temperature sensor"; +} + +std::string DecodeFrequencyDomain(ctl_freq_domain_t freqDomain) +{ + static const std::map freqDomainStringMap = { { CTL_FREQ_DOMAIN_GPU, "GPU" }, { CTL_FREQ_DOMAIN_MEMORY, "MEMORY" }, { CTL_FREQ_DOMAIN_MEDIA, "MEDIA" } }; + + auto it = freqDomainStringMap.find(freqDomain); + if (it != freqDomainStringMap.end()) + { + return it->second; + } + return "Unknown frequency domain"; +} + +std::string DecodeFanSpeedUnits(ctl_fan_speed_units_t Units) +{ + static const std::map unitsStringMap = { { CTL_FAN_SPEED_UNITS_RPM, "RPM" }, { CTL_FAN_SPEED_UNITS_PERCENT, "PERCENT" } }; + + auto it = unitsStringMap.find(Units); + if (it != unitsStringMap.end()) + { + return it->second; + } + return "Unknown fan speed unit"; +} + +std::string DecodeFanSpeedMode(ctl_fan_speed_mode_t fanSpeedMode) +{ + static const std::map fanSpeedModeStringMap = { { CTL_FAN_SPEED_MODE_DEFAULT, "DEFAULT/STOCK FAN TABLE" }, + { CTL_FAN_SPEED_MODE_FIXED, "FIXED SPEED" }, + { CTL_FAN_SPEED_MODE_TABLE, "USER FAN TABLE" } }; + + auto it = fanSpeedModeStringMap.find(fanSpeedMode); + if (it != fanSpeedModeStringMap.end()) + { + return it->second; + } + return "Unknown fan speed mode"; +} + +std::string DecodeEngineGroup(ctl_engine_group_t engineGroup) +{ + static const std::map engineGroupStringMap = { { CTL_ENGINE_GROUP_GT, "GT" }, { CTL_ENGINE_GROUP_RENDER, "RENDER" }, { CTL_ENGINE_GROUP_MEDIA, "MEDIA" } }; + + auto it = engineGroupStringMap.find(engineGroup); + if (it != engineGroupStringMap.end()) + { + return it->second; + } + return "Unknown engine group"; +} + +std::string DecodeBoolean(bool Value) +{ + return Value ? "true" : "false"; +} + +std::string DecodeEccState(ctl_ecc_state_t eccState) +{ + static const std::map eccStateStringMap = { { CTL_ECC_STATE_ECC_DEFAULT_STATE, "default" }, + { CTL_ECC_STATE_ECC_ENABLED_STATE, "enabled" }, + { CTL_ECC_STATE_ECC_DISABLED_STATE, "disabled" } }; + + auto it = eccStateStringMap.find(eccState); + if (it != eccStateStringMap.end()) + { + return it->second; + } + return "Unknown Ecc state"; +} + // Decoding the return code for the most common error codes. std::string DecodeRetCode(ctl_result_t Res) { @@ -180,10 +262,7 @@ void CtlTemperatureTest(ctl_device_adapter_handle_t hDAhandle) else { PRINT_LOGS("\n[Temperature] Max temp [%u]", (uint32_t)temperatureProperties.maxTemperature); - PRINT_LOGS("\n[Temperature] Sensor type [%s]", ((temperatureProperties.type == CTL_TEMP_SENSORS_GLOBAL) ? "Global" : - (temperatureProperties.type == CTL_TEMP_SENSORS_GPU) ? "Gpu" : - (temperatureProperties.type == CTL_TEMP_SENSORS_MEMORY) ? "Memory" : - "Unknown")); + PRINT_LOGS("\n[Temperature] Sensor type [%s]", DecodeTemperatureSensor(temperatureProperties.type).c_str()); } PRINT_LOGS("\n[Temperature] Get Temperature state:"); @@ -255,10 +334,7 @@ void CtlFrequencyTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\n[Frequency] Min [%f]] MHz", freqProperties.min); PRINT_LOGS("\n[Frequency] Max [%f]] MHz", freqProperties.max); PRINT_LOGS("\n[Frequency] Can Control Frequency? [%u]]", (uint32_t)freqProperties.canControl); - PRINT_LOGS("\n[Frequency] Frequency Domain [%s]]", ((freqProperties.type == CTL_FREQ_DOMAIN_GPU) ? "GPU" : - (freqProperties.type == CTL_FREQ_DOMAIN_MEMORY) ? "MEMORY" : - (freqProperties.type == CTL_FREQ_DOMAIN_MEDIA) ? "MEDIA" : - "Unknown")); + PRINT_LOGS("\n[Frequency] Frequency Domain [%s]]", DecodeFrequencyDomain(freqProperties.type).c_str()); } PRINT_LOGS("\n\n[Frequency] State:"); @@ -400,7 +476,7 @@ void CtlPowerTest(ctl_device_adapter_handle_t hDAhandle) } else { - PRINT_LOGS("\n[Power] Can Control [%u]", (uint32_t)properties.canControl); + PRINT_LOGS("\n[Power] Can Control [%s]", DecodeBoolean(properties.canControl).c_str()); PRINT_LOGS("\n[Power] Default Power Limit [%u]", (uint32_t)properties.defaultLimit); PRINT_LOGS("\n[Power] Max Power Limit [%i] mW", properties.maxLimit); PRINT_LOGS("\n[Power] Min Power Limit [%i] mW", properties.minLimit); @@ -434,10 +510,10 @@ void CtlPowerTest(ctl_device_adapter_handle_t hDAhandle) } else { - PRINT_LOGS("\n[Power] Sustained Power Limit Enabled [%u]", (uint32_t)powerLimits.sustainedPowerLimit.enabled); + PRINT_LOGS("\n[Power] Sustained Power Limit Enabled [%s]", DecodeBoolean(powerLimits.sustainedPowerLimit.enabled).c_str()); PRINT_LOGS("\n[Power] Sustained Power (PL1) Value [%i] mW", powerLimits.sustainedPowerLimit.power); PRINT_LOGS("\n[Power] Sustained Power (PL1 Tau) Time Window [%i] ms", powerLimits.sustainedPowerLimit.interval); - PRINT_LOGS("\n[Power] Burst Power Limit Enabled [%u]", (uint32_t)powerLimits.burstPowerLimit.enabled); + PRINT_LOGS("\n[Power] Burst Power Limit Enabled [%s]", DecodeBoolean(powerLimits.burstPowerLimit.enabled).c_str()); PRINT_LOGS("\n[Power] Burst Power (PL2) Value [%i] mW", powerLimits.burstPowerLimit.power); PRINT_LOGS("\n[Power] Peak Power (PL4) AC Value [%i] mW", powerLimits.peakPowerLimits.powerAC); PRINT_LOGS("\n[Power] Peak Power (PL4) DC Value [%i] mW", powerLimits.peakPowerLimits.powerDC); @@ -482,7 +558,7 @@ void CtlFanTest_FanGetConfig(ctl_fan_handle_t hFanHandle) } else { - PRINT_LOGS("\n[Fan] Fan Config Mode [%u]", FanConfig.mode); + PRINT_LOGS("\n[Fan] Fan Config Mode [%s]", DecodeFanSpeedMode(FanConfig.mode).c_str()); if (CTL_FAN_SPEED_MODE_DEFAULT == FanConfig.mode) { PRINT_LOGS("\n[Fan] Fan Config Mode: Default/Stock"); @@ -490,14 +566,14 @@ void CtlFanTest_FanGetConfig(ctl_fan_handle_t hFanHandle) else if (CTL_FAN_SPEED_MODE_FIXED == FanConfig.mode) { PRINT_LOGS("\n[Fan] Fan Config Fixed Speed [%u]", FanConfig.speedFixed.speed); - PRINT_LOGS("\n[Fan] Fan Config Fixed Speed Unit [%u]", FanConfig.speedFixed.units); + PRINT_LOGS("\n[Fan] Fan Config Fixed Speed Unit [%s]", DecodeFanSpeedUnits(FanConfig.speedFixed.units).c_str()); } else if (CTL_FAN_SPEED_MODE_TABLE == FanConfig.mode) { PRINT_LOGS("\n[Fan] Fan Config Fan Table NumPoints [%u]", FanConfig.speedTable.numPoints); for (int32_t numPoints = 0; numPoints < FanConfig.speedTable.numPoints; numPoints++) { - PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed Unit [%u]", FanConfig.speedTable.table[numPoints].speed.units); + PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed Unit [%s]", DecodeFanSpeedUnits(FanConfig.speedTable.table[numPoints].speed.units).c_str()); PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Speed [%u]", FanConfig.speedTable.table[numPoints].speed.speed); PRINT_LOGS("\n[Fan] Fan Config Fan Table Point Temperature [%u]", FanConfig.speedTable.table[numPoints].temperature); } @@ -552,7 +628,7 @@ void CtlFanTest(ctl_device_adapter_handle_t hDAhandle) } else { - PRINT_LOGS("\n[Fan] Can Control [%u]", (uint32_t)Fan_properties.canControl); + PRINT_LOGS("\n[Fan] Can Control [%s]", DecodeBoolean(Fan_properties.canControl).c_str()); PRINT_LOGS("\n[Fan] Max Points [%i]", Fan_properties.maxPoints); PRINT_LOGS("\n[Fan] Max RPM [%i]", Fan_properties.maxRPM); PRINT_LOGS("\n[Fan] Supported Modes [%u]", Fan_properties.supportedModes); @@ -815,10 +891,7 @@ void CtlEngineTest(ctl_device_adapter_handle_t hDAhandle) } else { - PRINT_LOGS("\n[Engine] Engine type [%s]", ((engineProperties.type == CTL_ENGINE_GROUP_GT) ? "Gt" : - (engineProperties.type == CTL_ENGINE_GROUP_RENDER) ? "Render" : - (engineProperties.type == CTL_ENGINE_GROUP_MEDIA) ? "Media" : - "Unknown")); + PRINT_LOGS("\n[Engine] Engine type [%s]", DecodeEngineGroup(engineProperties.type).c_str()); } ctl_engine_stats_t engineStats = { 0 }; @@ -917,10 +990,10 @@ void CtlLedTest(ctl_device_adapter_handle_t hDAhandle) } else { - PRINT_LOGS("\n[Led] Can Control [%u]", (uint32_t)LedProperties.canControl); - PRINT_LOGS("\n[Led] Is I2C [%u]", (uint32_t)LedProperties.isI2C); - PRINT_LOGS("\n[Led] Is PWM [%u]", (uint32_t)LedProperties.isPWM); - PRINT_LOGS("\n[Led] Have RGB [%u]", (uint32_t)LedProperties.haveRGB); + PRINT_LOGS("\n[Led] Can Control [%s]", DecodeBoolean(LedProperties.canControl).c_str()); + PRINT_LOGS("\n[Led] Is I2C [%s]", DecodeBoolean(LedProperties.isI2C).c_str()); + PRINT_LOGS("\n[Led] Is PWM [%s]", DecodeBoolean(LedProperties.isPWM).c_str()); + PRINT_LOGS("\n[Led] Have RGB [%s]", DecodeBoolean(LedProperties.haveRGB).c_str()); } PRINT_LOGS("\n\n[Led] Get Led state:"); @@ -936,7 +1009,7 @@ void CtlLedTest(ctl_device_adapter_handle_t hDAhandle) else { PRINT_LOGS("\n[Led] Get Led State successful"); - PRINT_LOGS("\n[Led] IsOn [%u]", (uint32_t)ledState.isOn); + PRINT_LOGS("\n[Led] IsOn [%s]", DecodeBoolean(ledState.isOn).c_str()); PRINT_LOGS("\n[Led] PWM: Led On/Off Ratio [%f]", ledState.pwm); PRINT_LOGS("\n[Led] Red color of Led [%f]", ledState.color.red); PRINT_LOGS("\n[Led] Green color of Led [%f]", ledState.color.green); @@ -970,6 +1043,134 @@ void CtlLedTest(ctl_device_adapter_handle_t hDAhandle) return; } +/*************************************************************** + * @brief Main Function + * place_holder_for_Detailed_desc + * @param + * @return + ***************************************************************/ +void CtlEccTest(ctl_device_adapter_handle_t hDAhandle) +{ + PRINT_LOGS("\n::::::::::::::Print Ecc Properties::::::::::::::\n"); + + // Get ECC Properites + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_ecc_properties_t EccProperties = { 0 }; + EccProperties.Size = sizeof(ctl_ecc_properties_t); + Result = ctlEccGetProperties(hDAhandle, &EccProperties); + + PRINT_LOGS("\n[Ecc] Get Ecc properties:"); + if (Result != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nEcc component not supported. Result: %s", DecodeRetCode(Result).c_str()); + return; + } + else + { + PRINT_LOGS("\n[Ecc] Is Supported [%s]", DecodeBoolean(EccProperties.isSupported).c_str()); + PRINT_LOGS("\n[Ecc] Can Control [%s]", DecodeBoolean(EccProperties.canControl).c_str()); + } + + if (EccProperties.isSupported) + { + // Get ECC State + ctl_ecc_state_desc_t eccState = { 0 }; + eccState.Size = sizeof(ctl_ecc_state_t); + Result = ctlEccGetState(hDAhandle, &eccState); + PRINT_LOGS("\n\n[Ecc] Get Ecc state:"); + if (Result != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nError: %s from Ecc Get state.\n", DecodeRetCode(Result).c_str()); + } + else + { + PRINT_LOGS("\n[Ecc] Ecc Get State successful"); + PRINT_LOGS("\n[Ecc] Current Ecc State [%s]", DecodeEccState(eccState.currentEccState).c_str()); + PRINT_LOGS("\n[Ecc] Pending Ecc State [%s]", DecodeEccState(eccState.pendingEccState).c_str()); + } + + if (eccState.currentEccState != eccState.pendingEccState) + { + PRINT_LOGS("\n[Ecc] Pending Ecc State[%s] is not applied yet from previous Ecc Set Call. Please reboot the system for it to take affect.", + DecodeEccState(eccState.pendingEccState).c_str()); + return; + } + else + { + PRINT_LOGS("\n[Ecc] Pending Ecc State [%s] from previous Ecc Set Call applied and ECC state toggled successfully.", DecodeEccState(eccState.pendingEccState).c_str()); + } + + if (EccProperties.canControl) + { + // Disabling ECC State if current ECC State is enabled and there is nothing to apply (currentEccState == pendingEccState) + if (eccState.currentEccState == CTL_ECC_STATE_ECC_ENABLED_STATE && eccState.currentEccState == eccState.pendingEccState) + { + eccState.currentEccState = CTL_ECC_STATE_ECC_DISABLED_STATE; + Result = ctlEccSetState(hDAhandle, &eccState); + PRINT_LOGS("\n\n[Ecc] Set Ecc state:"); + PRINT_LOGS("\n\n[Ecc] Disabling Ecc state [%s]", DecodeEccState(eccState.currentEccState).c_str()); + if (Result != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nError: %s from Ecc Set State\n", DecodeRetCode(Result).c_str()); + } + else + { + PRINT_LOGS("\n[Ecc] Ecc Set State call successful\n"); + PRINT_LOGS("\n[Ecc] Pending Ecc State to be applied from Ecc Set State call [%s]", DecodeEccState(eccState.pendingEccState).c_str()); + } + } + // Enabling ECC State if current ECC State if disabled and there is nothing to apply (currentEccState == pendingEccState) + else if (eccState.currentEccState == CTL_ECC_STATE_ECC_DISABLED_STATE && eccState.currentEccState == eccState.pendingEccState) + { + eccState.currentEccState = CTL_ECC_STATE_ECC_ENABLED_STATE; + Result = ctlEccSetState(hDAhandle, &eccState); + PRINT_LOGS("\n\n[Ecc] Set Ecc state:"); + PRINT_LOGS("\n\n[Ecc] Enabling Ecc state [%s]", DecodeEccState(eccState.currentEccState).c_str()); + if (Result != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nError: %s from Ecc Set State\n", DecodeRetCode(Result).c_str()); + } + else + { + PRINT_LOGS("\n[Ecc] Ecc Set State call successful\n"); + PRINT_LOGS("\n[Ecc] Pending Ecc State to be applied from Ecc Set State call [%s]", DecodeEccState(eccState.pendingEccState).c_str()); + } + } + + // Retrieving back ECC State after Ecc Set State call to determine if currentEccState == pendingEccState + Result = ctlEccGetState(hDAhandle, &eccState); + PRINT_LOGS("\n\n[Ecc] Get Ecc state again:"); + if (Result != CTL_RESULT_SUCCESS) + { + PRINT_LOGS("\nError: %s from Ecc Get state.\n", DecodeRetCode(Result).c_str()); + } + else + { + PRINT_LOGS("\n[Ecc] Ecc Get State successful"); + PRINT_LOGS("\n[Ecc] Current Ecc State [%s]", DecodeEccState(eccState.currentEccState).c_str()); + PRINT_LOGS("\n[Ecc] Pending Ecc State [%s]", DecodeEccState(eccState.pendingEccState).c_str()); + } + + // System reboot is needed always if currentEccState != pendingEccState for the pendingEccState to be applied + if (eccState.currentEccState != eccState.pendingEccState) + { + PRINT_LOGS("\n[Ecc] Pending Ecc State [%s] is not applied yet after the Ecc Set State call. Please reboot the system for it to take affect.", + DecodeEccState(eccState.pendingEccState).c_str()); + } + } + else + { + PRINT_LOGS("\n[Ecc] Ecc state cannot be changed on this system."); + } + } + else + { + PRINT_LOGS("\n[Ecc] ECC is not supported on this system."); + } + + return; +} + void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) { ctl_power_telemetry_t pPowerTelemetry = {}; @@ -984,168 +1185,168 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) if (pPowerTelemetry.timeStamp.bSupported) { - PRINT_LOGS("\nTimeStamp: %f (%s) Datatype:(%s)", pPowerTelemetry.timeStamp.value.datadouble, printUnits(pPowerTelemetry.timeStamp.units).c_str(), - printType(pPowerTelemetry.timeStamp.type).c_str()); + PRINT_LOGS("\nTimeStamp: %f (%s) Datatype:(%s)", pPowerTelemetry.timeStamp.value.datadouble, DecodeCtlUnits(pPowerTelemetry.timeStamp.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.timeStamp.type).c_str()); } if (pPowerTelemetry.gpuEnergyCounter.bSupported) { - PRINT_LOGS("\nGpu Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.gpuEnergyCounter.units).c_str(), - printType(pPowerTelemetry.gpuEnergyCounter.type).c_str()); + PRINT_LOGS("\nGpu Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEnergyCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuEnergyCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuEnergyCounter.type).c_str()); } if (pPowerTelemetry.vramEnergyCounter.bSupported) { - PRINT_LOGS("\nVRAM Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.vramEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.vramEnergyCounter.units).c_str(), - printType(pPowerTelemetry.vramEnergyCounter.type).c_str()); + PRINT_LOGS("\nVRAM Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.vramEnergyCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramEnergyCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramEnergyCounter.type).c_str()); } if (pPowerTelemetry.totalCardEnergyCounter.bSupported) { - PRINT_LOGS("\nCard Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.totalCardEnergyCounter.value.datadouble, printUnits(pPowerTelemetry.totalCardEnergyCounter.units).c_str(), - printType(pPowerTelemetry.totalCardEnergyCounter.type).c_str()); + PRINT_LOGS("\nCard Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.totalCardEnergyCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.totalCardEnergyCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.totalCardEnergyCounter.type).c_str()); } if (pPowerTelemetry.gpuVoltage.bSupported) { - PRINT_LOGS("\nGpu Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVoltage.value.datadouble, printUnits(pPowerTelemetry.gpuVoltage.units).c_str(), - printType(pPowerTelemetry.gpuVoltage.type).c_str()); + PRINT_LOGS("\nGpu Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVoltage.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuVoltage.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuVoltage.type).c_str()); } if (pPowerTelemetry.gpuCurrentClockFrequency.bSupported) { - PRINT_LOGS("\nGpu Current Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentClockFrequency.value.datadouble, printUnits(pPowerTelemetry.gpuCurrentClockFrequency.units).c_str(), - printType(pPowerTelemetry.gpuCurrentClockFrequency.type).c_str()); + PRINT_LOGS("\nGpu Current Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentClockFrequency.value.datadouble, + DecodeCtlUnits(pPowerTelemetry.gpuCurrentClockFrequency.units).c_str(), DecodeCtlDataType(pPowerTelemetry.gpuCurrentClockFrequency.type).c_str()); } if (pPowerTelemetry.gpuCurrentTemperature.bSupported) { - PRINT_LOGS("\nGpu Current Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentTemperature.value.datadouble, printUnits(pPowerTelemetry.gpuCurrentTemperature.units).c_str(), - printType(pPowerTelemetry.gpuCurrentTemperature.type).c_str()); + PRINT_LOGS("\nGpu Current Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuCurrentTemperature.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuCurrentTemperature.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuCurrentTemperature.type).c_str()); } if (pPowerTelemetry.globalActivityCounter.bSupported) { - PRINT_LOGS("\nGpu Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.globalActivityCounter.value.datadouble, printUnits(pPowerTelemetry.globalActivityCounter.units).c_str(), - printType(pPowerTelemetry.globalActivityCounter.type).c_str()); + PRINT_LOGS("\nGpu Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.globalActivityCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.globalActivityCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.globalActivityCounter.type).c_str()); } if (pPowerTelemetry.renderComputeActivityCounter.bSupported) { PRINT_LOGS("\nRender Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.renderComputeActivityCounter.value.datadouble, - printUnits(pPowerTelemetry.renderComputeActivityCounter.units).c_str(), printType(pPowerTelemetry.renderComputeActivityCounter.type).c_str()); + DecodeCtlUnits(pPowerTelemetry.renderComputeActivityCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.renderComputeActivityCounter.type).c_str()); } if (pPowerTelemetry.mediaActivityCounter.bSupported) { - PRINT_LOGS("\nMedia Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.mediaActivityCounter.value.datadouble, printUnits(pPowerTelemetry.mediaActivityCounter.units).c_str(), - printType(pPowerTelemetry.mediaActivityCounter.type).c_str()); + PRINT_LOGS("\nMedia Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.mediaActivityCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.mediaActivityCounter.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.mediaActivityCounter.type).c_str()); } if (pPowerTelemetry.vramVoltage.bSupported) { - PRINT_LOGS("\nVRAM Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVoltage.value.datadouble, printUnits(pPowerTelemetry.vramVoltage.units).c_str(), - printType(pPowerTelemetry.vramVoltage.type).c_str()); + PRINT_LOGS("\nVRAM Voltage: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVoltage.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramVoltage.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramVoltage.type).c_str()); } if (pPowerTelemetry.vramCurrentClockFrequency.bSupported) { - PRINT_LOGS("\nVRAM Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentClockFrequency.value.datadouble, printUnits(pPowerTelemetry.vramCurrentClockFrequency.units).c_str(), - printType(pPowerTelemetry.vramCurrentClockFrequency.type).c_str()); + PRINT_LOGS("\nVRAM Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentClockFrequency.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramCurrentClockFrequency.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramCurrentClockFrequency.type).c_str()); } if (pPowerTelemetry.vramReadBandwidthCounter.bSupported) { PRINT_LOGS("\nVRAM Read Bandwidth Counter: %llu (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidthCounter.value.datau64, - printUnits(pPowerTelemetry.vramReadBandwidthCounter.units).c_str(), printType(pPowerTelemetry.vramReadBandwidthCounter.type).c_str()); + DecodeCtlUnits(pPowerTelemetry.vramReadBandwidthCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.vramReadBandwidthCounter.type).c_str()); } if (pPowerTelemetry.vramWriteBandwidthCounter.bSupported) { PRINT_LOGS("\nVRAM Write Bandwidth Counter: %llu (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidthCounter.value.datau64, - printUnits(pPowerTelemetry.vramWriteBandwidthCounter.units).c_str(), printType(pPowerTelemetry.vramWriteBandwidthCounter.type).c_str()); + DecodeCtlUnits(pPowerTelemetry.vramWriteBandwidthCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.vramWriteBandwidthCounter.type).c_str()); } if (pPowerTelemetry.vramCurrentEffectiveFrequency.bSupported) { PRINT_LOGS("\nVRAM Effective Frequency: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentEffectiveFrequency.value.datadouble, - printUnits(pPowerTelemetry.vramCurrentEffectiveFrequency.units).c_str(), printType(pPowerTelemetry.vramCurrentEffectiveFrequency.type).c_str()); + DecodeCtlUnits(pPowerTelemetry.vramCurrentEffectiveFrequency.units).c_str(), DecodeCtlDataType(pPowerTelemetry.vramCurrentEffectiveFrequency.type).c_str()); } if (pPowerTelemetry.vramCurrentTemperature.bSupported) { - PRINT_LOGS("\nVRAM Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentTemperature.value.datadouble, printUnits(pPowerTelemetry.vramCurrentTemperature.units).c_str(), - printType(pPowerTelemetry.vramCurrentTemperature.type).c_str()); + PRINT_LOGS("\nVRAM Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramCurrentTemperature.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramCurrentTemperature.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramCurrentTemperature.type).c_str()); } if (pPowerTelemetry.vramReadBandwidth.bSupported) { - PRINT_LOGS("\nVRAM Read Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidth.value.datadouble, printUnits(pPowerTelemetry.vramReadBandwidth.units).c_str(), - printType(pPowerTelemetry.vramReadBandwidth.type).c_str()); + PRINT_LOGS("\nVRAM Read Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramReadBandwidth.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramReadBandwidth.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramReadBandwidth.type).c_str()); } if (pPowerTelemetry.vramWriteBandwidth.bSupported) { - PRINT_LOGS("\nVRAM Write Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidth.value.datadouble, printUnits(pPowerTelemetry.vramWriteBandwidth.units).c_str(), - printType(pPowerTelemetry.vramWriteBandwidth.type).c_str()); + PRINT_LOGS("\nVRAM Write Bandwidth: %f (%s) Datatype:(%s)", pPowerTelemetry.vramWriteBandwidth.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramWriteBandwidth.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramWriteBandwidth.type).c_str()); } if (pPowerTelemetry.gpuVrTemp.bSupported) { - PRINT_LOGS("\nGPU VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVrTemp.value.datadouble, printUnits(pPowerTelemetry.gpuVrTemp.units).c_str(), - printType(pPowerTelemetry.gpuVrTemp.type).c_str()); + PRINT_LOGS("\nGPU VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuVrTemp.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuVrTemp.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuVrTemp.type).c_str()); } if (pPowerTelemetry.vramVrTemp.bSupported) { - PRINT_LOGS("\nVRAM VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVrTemp.value.datadouble, printUnits(pPowerTelemetry.vramVrTemp.units).c_str(), - printType(pPowerTelemetry.vramVrTemp.type).c_str()); + PRINT_LOGS("\nVRAM VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.vramVrTemp.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramVrTemp.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.vramVrTemp.type).c_str()); } if (pPowerTelemetry.saVrTemp.bSupported) { - PRINT_LOGS("\nSA VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.saVrTemp.value.datadouble, printUnits(pPowerTelemetry.saVrTemp.units).c_str(), - printType(pPowerTelemetry.saVrTemp.type).c_str()); + PRINT_LOGS("\nSA VR Temperature: %f (%s) Datatype:(%s)", pPowerTelemetry.saVrTemp.value.datadouble, DecodeCtlUnits(pPowerTelemetry.saVrTemp.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.saVrTemp.type).c_str()); } if (pPowerTelemetry.gpuEffectiveClock.bSupported) { - PRINT_LOGS("\nEffective frequency of the GPU: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEffectiveClock.value.datadouble, printUnits(pPowerTelemetry.gpuEffectiveClock.units).c_str(), - printType(pPowerTelemetry.gpuEffectiveClock.type).c_str()); + PRINT_LOGS("\nEffective frequency of the GPU: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEffectiveClock.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuEffectiveClock.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuEffectiveClock.type).c_str()); } if (pPowerTelemetry.gpuOverVoltagePercent.bSupported) { - PRINT_LOGS("\nGPU Overvoltage Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuOverVoltagePercent.value.datadouble, printUnits(pPowerTelemetry.gpuOverVoltagePercent.units).c_str(), - printType(pPowerTelemetry.gpuOverVoltagePercent.type).c_str()); + PRINT_LOGS("\nGPU Overvoltage Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuOverVoltagePercent.value.datadouble, + DecodeCtlUnits(pPowerTelemetry.gpuOverVoltagePercent.units).c_str(), DecodeCtlDataType(pPowerTelemetry.gpuOverVoltagePercent.type).c_str()); } if (pPowerTelemetry.gpuPowerPercent.bSupported) { - PRINT_LOGS("\nGPU Power Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuPowerPercent.value.datadouble, printUnits(pPowerTelemetry.gpuPowerPercent.units).c_str(), - printType(pPowerTelemetry.gpuPowerPercent.type).c_str()); + PRINT_LOGS("\nGPU Power Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuPowerPercent.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuPowerPercent.units).c_str(), + DecodeCtlDataType(pPowerTelemetry.gpuPowerPercent.type).c_str()); } if (pPowerTelemetry.gpuTemperaturePercent.bSupported) { - PRINT_LOGS("\nGPU Temperature Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuTemperaturePercent.value.datadouble, printUnits(pPowerTelemetry.gpuTemperaturePercent.units).c_str(), - printType(pPowerTelemetry.gpuTemperaturePercent.type).c_str()); + PRINT_LOGS("\nGPU Temperature Percentage: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuTemperaturePercent.value.datadouble, + DecodeCtlUnits(pPowerTelemetry.gpuTemperaturePercent.units).c_str(), DecodeCtlDataType(pPowerTelemetry.gpuTemperaturePercent.type).c_str()); } for (int i = 0; i < CTL_FAN_COUNT; i++) { if (pPowerTelemetry.fanSpeed[i].bSupported) { - PRINT_LOGS("\nFan[%d] Speed: %f (%s) Datatype:(%s)", i, pPowerTelemetry.fanSpeed[i].value.datadouble, printUnits(pPowerTelemetry.fanSpeed[i].units).c_str(), - printType(pPowerTelemetry.fanSpeed[i].type).c_str()); + PRINT_LOGS("\nFan[%d] Speed: %f (%s) Datatype:(%s)", i, pPowerTelemetry.fanSpeed[i].value.datadouble, DecodeCtlUnits(pPowerTelemetry.fanSpeed[i].units).c_str(), + DecodeCtlDataType(pPowerTelemetry.fanSpeed[i].type).c_str()); } } - PRINT_LOGS("\ngpuPowerLimited: %s", ((pPowerTelemetry.gpuPowerLimited) ? "true" : "false")); - PRINT_LOGS("\ngpuTemperatureLimited: %s", ((pPowerTelemetry.gpuTemperatureLimited) ? "true" : "false")); - PRINT_LOGS("\ngpuCurrentLimited: %s", ((pPowerTelemetry.gpuCurrentLimited) ? "true" : "false")); - PRINT_LOGS("\ngpuVoltageLimited: %s", ((pPowerTelemetry.gpuVoltageLimited) ? "true" : "false")); - PRINT_LOGS("\ngpuUtilizationLimited: %s", ((pPowerTelemetry.gpuUtilizationLimited) ? "true" : "false")); + PRINT_LOGS("\ngpuPowerLimited: %s", DecodeBoolean(pPowerTelemetry.gpuPowerLimited).c_str()); + PRINT_LOGS("\ngpuTemperatureLimited: %s", DecodeBoolean(pPowerTelemetry.gpuTemperatureLimited).c_str()); + PRINT_LOGS("\ngpuCurrentLimited: %s", DecodeBoolean(pPowerTelemetry.gpuCurrentLimited).c_str()); + PRINT_LOGS("\ngpuVoltageLimited: %s", DecodeBoolean(pPowerTelemetry.gpuVoltageLimited).c_str()); + PRINT_LOGS("\ngpuUtilizationLimited: %s", DecodeBoolean(pPowerTelemetry.gpuUtilizationLimited).c_str()); } else { @@ -1219,6 +1420,14 @@ void PerComponentTest(ctl_device_adapter_handle_t hDAhandle) { printf("%s \n", e.what()); } + try + { + CtlEccTest(hDAhandle); + } + catch (const std::bad_array_new_length &e) + { + printf("%s \n", e.what()); + } } /*************************************************************** diff --git a/Samples/inc/GenericIGCLApp.h b/Samples/inc/GenericIGCLApp.h index 5635966..723744e 100644 --- a/Samples/inc/GenericIGCLApp.h +++ b/Samples/inc/GenericIGCLApp.h @@ -118,6 +118,8 @@ inline char *Get3DFeatureName(ctl_3d_feature_t FeatureType) return "global or per app settings"; case CTL_3D_FEATURE_LOW_LATENCY: return "Low Latency"; + case CTL_3D_FEATURE_FRAME_GENERATION: + return "XeSS Frame Generation"; default: return "No Name"; } diff --git a/Source/cApiWrapper.cpp b/Source/cApiWrapper.cpp index 4da89cd..5af1d6c 100644 --- a/Source/cApiWrapper.cpp +++ b/Source/cApiWrapper.cpp @@ -2513,6 +2513,139 @@ ctlGetSetDisplaySettings( } +/** +* @brief Get ECC properties. +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pProperties` +*/ +ctl_result_t CTL_APICALL +ctlEccGetProperties( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_ecc_properties_t* pProperties ///< [in,out] Will contain ECC properties. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEccGetProperties_t pfnEccGetProperties = (ctl_pfnEccGetProperties_t)GetProcAddress(hinstLibPtr, "ctlEccGetProperties"); + if (pfnEccGetProperties) + { + result = pfnEccGetProperties(hDAhandle, pProperties); + } + } + + return result; +} + + +/** +* @brief Get ECC state. +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pState` +* - CTL_RESULT_ERROR_INVALID_ENUMERATION +* + `::CTL_ECC_STATE_ECC_DISABLED_STATE < pState->currentEccState` +* + `::CTL_ECC_STATE_ECC_DISABLED_STATE < pState->pendingEccState` +*/ +ctl_result_t CTL_APICALL +ctlEccGetState( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_ecc_state_desc_t* pState ///< [in,out] Will contain the current ECC state and pending ECC state to + ///< be applied from previous ctlEccSetState() call. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEccGetState_t pfnEccGetState = (ctl_pfnEccGetState_t)GetProcAddress(hinstLibPtr, "ctlEccGetState"); + if (pfnEccGetState) + { + result = pfnEccGetState(hDAhandle, pState); + } + } + + return result; +} + + +/** +* @brief Set ECC state. Setting CTL_ECC_STATE_ECC_DEFAULT_STATE will reset the +* ECC state to the factory settings. +* +* @details +* - The application may call this function from simultaneous threads. +* - The implementation of this function should be lock-free. +* +* @returns +* - CTL_RESULT_SUCCESS +* - CTL_RESULT_ERROR_UNINITIALIZED +* - CTL_RESULT_ERROR_DEVICE_LOST +* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +* + `nullptr == hDAhandle` +* - CTL_RESULT_ERROR_INVALID_NULL_POINTER +* + `nullptr == pState` +* - CTL_RESULT_ERROR_INVALID_ENUMERATION +* + `::CTL_ECC_STATE_ECC_DISABLED_STATE < pState->currentEccState` +* + `::CTL_ECC_STATE_ECC_DISABLED_STATE < pState->pendingEccState` +*/ +ctl_result_t CTL_APICALL +ctlEccSetState( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_ecc_state_desc_t* pState ///< [in,out] Will contain the new ECC state and pending ECC state from + ///< ctlEccSetState() call. + ///< New ECC State can be set only if isSupported is true and canControl is true. + ///< ctlEccGetState() can be called to determine if the currentEccState is + ///< not equal to pendingEccState, then system reboot is needed for the + ///< pendingEccState to be applied. + ) +{ + ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; + + + HINSTANCE hinstLibPtr = GetLoaderHandle(); + + if (NULL != hinstLibPtr) + { + ctl_pfnEccSetState_t pfnEccSetState = (ctl_pfnEccSetState_t)GetProcAddress(hinstLibPtr, "ctlEccSetState"); + if (pfnEccSetState) + { + result = pfnEccSetState(hDAhandle, pState); + } + } + + return result; +} + + /** * @brief Get handle of engine groups * @@ -3098,6 +3231,9 @@ ctlGetFirmwareComponentProperties( * @details * - This API allows caller to allow/block a compatible discrete graphics * card's firmware train PCIE links at higher speeds on compatible hosts. +* - System needs to be powered off and restarted for the new state to take +* affect. The new state will not be applied on only a warm reboot of the +* system. * - This is a reserved capability. By default, this capability will not be * enabled, need application to activate it, please contact Intel for * activation. diff --git a/include/igcl_api.h b/include/igcl_api.h index 547965f..2291a07 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -1263,6 +1263,14 @@ typedef struct _ctl_get_set_wire_format_config_t ctl_get_set_wire_format_config_ /// @brief Forward-declare ctl_display_settings_t typedef struct _ctl_display_settings_t ctl_display_settings_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_ecc_properties_t +typedef struct _ctl_ecc_properties_t ctl_ecc_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Forward-declare ctl_ecc_state_desc_t +typedef struct _ctl_ecc_state_desc_t ctl_ecc_state_desc_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ctl_engine_properties_t typedef struct _ctl_engine_properties_t ctl_engine_properties_t; @@ -1504,6 +1512,7 @@ typedef enum _ctl_3d_feature_t CTL_3D_FEATURE_VRR_WINDOWED_BLT = 14, ///< VRR windowed blt. Control VRR for windowed mode game CTL_3D_FEATURE_GLOBAL_OR_PER_APP = 15, ///< Set global settings or per application settings CTL_3D_FEATURE_LOW_LATENCY = 16, ///< Low latency mode. Contains generic enum type fields + CTL_3D_FEATURE_FRAME_GENERATION = 17, ///< Frame Generation CTL_3D_FEATURE_MAX } ctl_3d_feature_t; @@ -4709,6 +4718,130 @@ ctlGetSetDisplaySettings( #if !defined(__GNUC__) #pragma endregion // display #endif +// Intel 'ctlApi' for Device Adapter - ECC +#if !defined(__GNUC__) +#pragma region ecc +#endif +/////////////////////////////////////////////////////////////////////////////// +/// @brief ECC properties. +typedef struct _ctl_ecc_properties_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + bool isSupported; ///< [out] Indicates if ECC support is available. + bool canControl; ///< [out] Indicates if software can control the ECC assuming the user has + ///< permissions. + +} ctl_ecc_properties_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief ECC state. +typedef enum _ctl_ecc_state_t +{ + CTL_ECC_STATE_ECC_DEFAULT_STATE = 0, ///< ECC Default State + CTL_ECC_STATE_ECC_ENABLED_STATE = 1, ///< ECC Enabled State + CTL_ECC_STATE_ECC_DISABLED_STATE = 2, ///< ECC Disabled State + CTL_ECC_STATE_MAX + +} ctl_ecc_state_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief ECC state descriptor. If the currentEccState is not equal to +/// pendingEccState, then system reboot is needed for the pendingEccState +/// to be applied. +typedef struct _ctl_ecc_state_desc_t +{ + uint32_t Size; ///< [in] size of this structure + uint8_t Version; ///< [in] version of this structure + ctl_ecc_state_t currentEccState; ///< [in,out] Indicates the ECC state. + ///< A valid input can be one of the ::ctl_ecc_state_t enum values. + ///< A valid output will be either CTL_ECC_STATE_ECC_ENABLED_STATE or CTL_ECC_STATE_ECC_DISABLED_STATE. + ctl_ecc_state_t pendingEccState; ///< [out] Indicates the pending ECC state from ctlEccSetState() call. A + ///< valid output will be either CTL_ECC_STATE_ECC_ENABLED_STATE or + ///< CTL_ECC_STATE_ECC_DISABLED_STATE. + +} ctl_ecc_state_desc_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get ECC properties. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pProperties` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEccGetProperties( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_ecc_properties_t* pProperties ///< [in,out] Will contain ECC properties. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Get ECC state. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +/// - CTL_RESULT_ERROR_INVALID_ENUMERATION +/// + `::CTL_ECC_STATE_ECC_DISABLED_STATE < pState->currentEccState` +/// + `::CTL_ECC_STATE_ECC_DISABLED_STATE < pState->pendingEccState` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEccGetState( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_ecc_state_desc_t* pState ///< [in,out] Will contain the current ECC state and pending ECC state to + ///< be applied from previous ctlEccSetState() call. + ); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set ECC state. Setting CTL_ECC_STATE_ECC_DEFAULT_STATE will reset the +/// ECC state to the factory settings. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - The implementation of this function should be lock-free. +/// +/// @returns +/// - CTL_RESULT_SUCCESS +/// - CTL_RESULT_ERROR_UNINITIALIZED +/// - CTL_RESULT_ERROR_DEVICE_LOST +/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `nullptr == hDAhandle` +/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER +/// + `nullptr == pState` +/// - CTL_RESULT_ERROR_INVALID_ENUMERATION +/// + `::CTL_ECC_STATE_ECC_DISABLED_STATE < pState->currentEccState` +/// + `::CTL_ECC_STATE_ECC_DISABLED_STATE < pState->pendingEccState` +CTL_APIEXPORT ctl_result_t CTL_APICALL +ctlEccSetState( + ctl_device_adapter_handle_t hDAhandle, ///< [in][release] Handle to display adapter + ctl_ecc_state_desc_t* pState ///< [in,out] Will contain the new ECC state and pending ECC state from + ///< ctlEccSetState() call. + ///< New ECC State can be set only if isSupported is true and canControl is true. + ///< ctlEccGetState() can be called to determine if the currentEccState is + ///< not equal to pendingEccState, then system reboot is needed for the + ///< pendingEccState to be applied. + ); + + +#if !defined(__GNUC__) +#pragma endregion // ecc +#endif // Intel 'ctlApi' for Device Adapter - Engine groups #if !defined(__GNUC__) #pragma region engine @@ -5282,6 +5415,9 @@ ctlGetFirmwareComponentProperties( /// @details /// - This API allows caller to allow/block a compatible discrete graphics /// card's firmware train PCIE links at higher speeds on compatible hosts. +/// - System needs to be powered off and restarted for the new state to take +/// affect. The new state will not be applied on only a warm reboot of the +/// system. /// - This is a reserved capability. By default, this capability will not be /// enabled, need application to activate it, please contact Intel for /// activation. @@ -8344,6 +8480,30 @@ typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDisplaySettings_t)( ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEccGetProperties +typedef ctl_result_t (CTL_APICALL *ctl_pfnEccGetProperties_t)( + ctl_device_adapter_handle_t, + ctl_ecc_properties_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEccGetState +typedef ctl_result_t (CTL_APICALL *ctl_pfnEccGetState_t)( + ctl_device_adapter_handle_t, + ctl_ecc_state_desc_t* + ); + + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for ctlEccSetState +typedef ctl_result_t (CTL_APICALL *ctl_pfnEccSetState_t)( + ctl_device_adapter_handle_t, + ctl_ecc_state_desc_t* + ); + + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for ctlEnumEngineGroups typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumEngineGroups_t)( From 523a5234227abf2751f3401b481a9a0d29c57813 Mon Sep 17 00:00:00 2001 From: SameerKP Date: Tue, 23 Sep 2025 08:57:15 -0700 Subject: [PATCH 19/26] Update README.md Adding level0 dependent API list --- README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 12f3e4b..40bfb9d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,54 @@ IGCL is meant to be a collection of high level APIs for all control aspects of h * IGCL binaries are distributed as part of Intel Graphics driver package. * Header & library wrapper code are provided here to help developers with their application development. * For API/spec questions or issues, for now, use the "Issues" tab under Github. For issues related to an already shipped binary of this spec, contact standard Intel customer support for Graphics. -* Performance & Telemetry API's, i.e., Engine/Fan/Telemetry/Frequency/Memory/Overclock/PCI/Power/Temperature are limited to 64-bit applications as of now. This is a Level0 limitation. +* Core API's related to Engine/Fan/Frequency/Memory/Overclock/PCI/Power/Temperature are limited to 64-bit applications. This is a Level0 limitation which is limited to 64-bit. For these API's, IGCL uses Level0 library. + + Device Frequency APIs + - ctlEnumFrequencyDomains + - ctlFrequencyGetProperties + - ctlFrequencyGetAvailableClocks + - ctlFrequencyGetRange + - ctlFrequencySetRange + - ctlFrequencyGetState + - ctlFrequencyGetThrottleTime + + Temperature APIs + - ctlEnumTemperatureSensors + - ctlTemperatureGetProperties + - ctlTemperatureGetState + + Power APIs + - ctlEnumPowerDomains + - ctlPowerGetProperties + - ctlPowerGetEnergyCounter + - ctlPowerGetLimits + - ctlPowerSetLimits + + Fan APIs + - ctlEnumFans + - ctlFanGetProperties + - ctlFanGetConfig + - ctlFanGetState + - ctlFanSetDefaultMode + - ctlFanSetFixedSpeedMode + - ctlFanSetSpeedTableMode + + PCI APIs + - ctlPciGetProperties + - ctlPciGetState + + Memory APIs + - ctlEnumMemoryModules + - ctlMemoryGetProperties + - ctlMemoryGetState + - ctlMemoryGetBandwidth + + Engine APIs + - ctlEnumEngineGroups + - ctlEngineGetProperties + - ctlEngineGetActivity + + More details on Level0 can be found at https://oneapi-src.github.io/level-zero-spec/level-zero/latest/index.html # Usage cmake.exe -B -S -G "Visual Studio 17 2022" -A x64 From b0f4524080d8c47d38f4ad98f704f7ddb9d6b784 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Fri, 26 Sep 2025 08:31:37 -0700 Subject: [PATCH 20/26] Updated version to v252 --- README.md | 49 +--------- .../3D_Feature_Sample_App.cpp | 1 - .../Telemetry_Samples/Sample_TelemetryAPP.cpp | 91 +++++++++++++++++++ 3 files changed, 92 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 40bfb9d..12f3e4b 100644 --- a/README.md +++ b/README.md @@ -9,54 +9,7 @@ IGCL is meant to be a collection of high level APIs for all control aspects of h * IGCL binaries are distributed as part of Intel Graphics driver package. * Header & library wrapper code are provided here to help developers with their application development. * For API/spec questions or issues, for now, use the "Issues" tab under Github. For issues related to an already shipped binary of this spec, contact standard Intel customer support for Graphics. -* Core API's related to Engine/Fan/Frequency/Memory/Overclock/PCI/Power/Temperature are limited to 64-bit applications. This is a Level0 limitation which is limited to 64-bit. For these API's, IGCL uses Level0 library. - - Device Frequency APIs - - ctlEnumFrequencyDomains - - ctlFrequencyGetProperties - - ctlFrequencyGetAvailableClocks - - ctlFrequencyGetRange - - ctlFrequencySetRange - - ctlFrequencyGetState - - ctlFrequencyGetThrottleTime - - Temperature APIs - - ctlEnumTemperatureSensors - - ctlTemperatureGetProperties - - ctlTemperatureGetState - - Power APIs - - ctlEnumPowerDomains - - ctlPowerGetProperties - - ctlPowerGetEnergyCounter - - ctlPowerGetLimits - - ctlPowerSetLimits - - Fan APIs - - ctlEnumFans - - ctlFanGetProperties - - ctlFanGetConfig - - ctlFanGetState - - ctlFanSetDefaultMode - - ctlFanSetFixedSpeedMode - - ctlFanSetSpeedTableMode - - PCI APIs - - ctlPciGetProperties - - ctlPciGetState - - Memory APIs - - ctlEnumMemoryModules - - ctlMemoryGetProperties - - ctlMemoryGetState - - ctlMemoryGetBandwidth - - Engine APIs - - ctlEnumEngineGroups - - ctlEngineGetProperties - - ctlEngineGetActivity - - More details on Level0 can be found at https://oneapi-src.github.io/level-zero-spec/level-zero/latest/index.html +* Performance & Telemetry API's, i.e., Engine/Fan/Telemetry/Frequency/Memory/Overclock/PCI/Power/Temperature are limited to 64-bit applications as of now. This is a Level0 limitation. # Usage cmake.exe -B -S -G "Visual Studio 17 2022" -A x64 diff --git a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp index 439a649..a780e70 100644 --- a/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp +++ b/Samples/3D_Feature_Samples/3D_Feature_Sample_App.cpp @@ -890,7 +890,6 @@ ctl_result_t CtlGlobalOrPerAppTest(ctl_device_adapter_handle_t hDevices) return Result; } - /*************************************************************** * @brief * Method to test Frame Limit diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index 32aef44..87ceaed 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -1179,6 +1179,9 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) ctl_result_t Status = ctlPowerTelemetryGet(hDAhandle, &pPowerTelemetry); + static bool firstSample = true; + double timeDiff = 0.0; + if (Status == ctl_result_t::CTL_RESULT_SUCCESS) { PRINT_LOGS("\nTelemetry Success\n \n"); @@ -1187,24 +1190,71 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) { PRINT_LOGS("\nTimeStamp: %f (%s) Datatype:(%s)", pPowerTelemetry.timeStamp.value.datadouble, DecodeCtlUnits(pPowerTelemetry.timeStamp.units).c_str(), DecodeCtlDataType(pPowerTelemetry.timeStamp.type).c_str()); + + // Calculate time difference between current and previous timestamp + static double prevTimeStamp = 0.0; + if (!firstSample) + { + timeDiff = pPowerTelemetry.timeStamp.value.datadouble - prevTimeStamp; + } + prevTimeStamp = pPowerTelemetry.timeStamp.value.datadouble; } if (pPowerTelemetry.gpuEnergyCounter.bSupported) { PRINT_LOGS("\nGpu Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.gpuEnergyCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.gpuEnergyCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.gpuEnergyCounter.type).c_str()); + + // Calculate and display power based on energy counter if we have previous values + static double prevGpuEnergyCounter = 0.0; + if (!firstSample && pPowerTelemetry.timeStamp.bSupported) + { + double energyDiff = pPowerTelemetry.gpuEnergyCounter.value.datadouble - prevGpuEnergyCounter; + if (timeDiff > 0.0) + { + double powerWatts = energyDiff / timeDiff; + PRINT_LOGS("GPU Power (calculated): %f Watts", powerWatts); + } + } + prevGpuEnergyCounter = pPowerTelemetry.gpuEnergyCounter.value.datadouble; } if (pPowerTelemetry.vramEnergyCounter.bSupported) { PRINT_LOGS("\nVRAM Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.vramEnergyCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.vramEnergyCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.vramEnergyCounter.type).c_str()); + + // Calculate and display VRAM power based on energy counter if we have previous values + static double prevVramEnergyCounter = 0.0; + if (!firstSample && pPowerTelemetry.timeStamp.bSupported) + { + double energyDiff = pPowerTelemetry.vramEnergyCounter.value.datadouble - prevVramEnergyCounter; + if (timeDiff > 0.0) + { + double powerWatts = energyDiff / timeDiff; + PRINT_LOGS("VRAM Power (calculated): %f Watts", powerWatts); + } + } + prevVramEnergyCounter = pPowerTelemetry.vramEnergyCounter.value.datadouble; } if (pPowerTelemetry.totalCardEnergyCounter.bSupported) { PRINT_LOGS("\nCard Energy Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.totalCardEnergyCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.totalCardEnergyCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.totalCardEnergyCounter.type).c_str()); + + // Calculate and display total card power based on energy counter if we have previous values + static double prevTotalCardEnergyCounter = 0.0; + if (!firstSample && pPowerTelemetry.timeStamp.bSupported) + { + double energyDiff = pPowerTelemetry.totalCardEnergyCounter.value.datadouble - prevTotalCardEnergyCounter; + if (timeDiff > 0.0) + { + double powerWatts = energyDiff / timeDiff; + PRINT_LOGS("Total Card Power (calculated): %f Watts", powerWatts); + } + } + prevTotalCardEnergyCounter = pPowerTelemetry.totalCardEnergyCounter.value.datadouble; } if (pPowerTelemetry.gpuVoltage.bSupported) @@ -1229,18 +1279,57 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) { PRINT_LOGS("\nGpu Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.globalActivityCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.globalActivityCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.globalActivityCounter.type).c_str()); + + // Calculate and display GPU utilization based on global activity counter + static double prevGlobalActivityCounter = 0.0; + if (!firstSample && pPowerTelemetry.timeStamp.bSupported) + { + double activityDiff = pPowerTelemetry.globalActivityCounter.value.datadouble - prevGlobalActivityCounter; + if (timeDiff > 0.0) + { + double utilization = (activityDiff / timeDiff) * 100.0; // Convert to percentage + PRINT_LOGS("GPU Utilization (calculated): %f%%", utilization); + } + } + prevGlobalActivityCounter = pPowerTelemetry.globalActivityCounter.value.datadouble; } if (pPowerTelemetry.renderComputeActivityCounter.bSupported) { PRINT_LOGS("\nRender Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.renderComputeActivityCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.renderComputeActivityCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.renderComputeActivityCounter.type).c_str()); + + // Calculate and display renderCompute utilization based on renderCompute activity counter + static double prevRenderComputeActivityCounter = 0.0; + if (!firstSample && pPowerTelemetry.timeStamp.bSupported) + { + double activityDiff = pPowerTelemetry.renderComputeActivityCounter.value.datadouble - prevRenderComputeActivityCounter; + if (timeDiff > 0.0) + { + double utilization = (activityDiff / timeDiff) * 100.0; // Convert to percentage + PRINT_LOGS("RenderCompute Utilization (calculated): %f%%", utilization); + } + } + prevRenderComputeActivityCounter = pPowerTelemetry.renderComputeActivityCounter.value.datadouble; } if (pPowerTelemetry.mediaActivityCounter.bSupported) { PRINT_LOGS("\nMedia Activity Counter: %f (%s) Datatype:(%s)", pPowerTelemetry.mediaActivityCounter.value.datadouble, DecodeCtlUnits(pPowerTelemetry.mediaActivityCounter.units).c_str(), DecodeCtlDataType(pPowerTelemetry.mediaActivityCounter.type).c_str()); + + // Calculate and display media utilization based on media activity counter + static double prevMediaActivityCounter = 0.0; + if (!firstSample && pPowerTelemetry.timeStamp.bSupported) + { + double activityDiff = pPowerTelemetry.mediaActivityCounter.value.datadouble - prevMediaActivityCounter; + if (timeDiff > 0.0) + { + double utilization = (activityDiff / timeDiff) * 100.0; // Convert to percentage + PRINT_LOGS("Media Utilization (calculated): %f%%", utilization); + } + } + prevMediaActivityCounter = pPowerTelemetry.mediaActivityCounter.value.datadouble; } if (pPowerTelemetry.vramVoltage.bSupported) @@ -1347,6 +1436,8 @@ void CtlPowerTelemetryTest(ctl_device_adapter_handle_t hDAhandle) PRINT_LOGS("\ngpuCurrentLimited: %s", DecodeBoolean(pPowerTelemetry.gpuCurrentLimited).c_str()); PRINT_LOGS("\ngpuVoltageLimited: %s", DecodeBoolean(pPowerTelemetry.gpuVoltageLimited).c_str()); PRINT_LOGS("\ngpuUtilizationLimited: %s", DecodeBoolean(pPowerTelemetry.gpuUtilizationLimited).c_str()); + + firstSample = false; } else { From 92ae846dcc5bd782e33bd1a43e39b5cd43d4adaf Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Thu, 30 Oct 2025 23:50:07 -0700 Subject: [PATCH 21/26] Updated version to v255 --- Samples/Generic_Sample/Sample_ControlAPP.cpp | 6 ++++++ Samples/inc/GenericIGCLApp.h | 2 ++ include/igcl_api.h | 1 + 3 files changed, 9 insertions(+) diff --git a/Samples/Generic_Sample/Sample_ControlAPP.cpp b/Samples/Generic_Sample/Sample_ControlAPP.cpp index 46c853e..c532929 100644 --- a/Samples/Generic_Sample/Sample_ControlAPP.cpp +++ b/Samples/Generic_Sample/Sample_ControlAPP.cpp @@ -924,6 +924,12 @@ ctl_result_t CtlAdapterTesting(ctl_device_adapter_handle_t *hDevices, uint32_t A } } + if (StDeviceAdapterProperties.pDeviceID != nullptr) + { + free(StDeviceAdapterProperties.pDeviceID); + StDeviceAdapterProperties.pDeviceID = nullptr; + } + return Result; } diff --git a/Samples/inc/GenericIGCLApp.h b/Samples/inc/GenericIGCLApp.h index 723744e..d99de21 100644 --- a/Samples/inc/GenericIGCLApp.h +++ b/Samples/inc/GenericIGCLApp.h @@ -120,6 +120,8 @@ inline char *Get3DFeatureName(ctl_3d_feature_t FeatureType) return "Low Latency"; case CTL_3D_FEATURE_FRAME_GENERATION: return "XeSS Frame Generation"; + case CTL_3D_FEATURE_PREBUILT_SHADER_DOWNLOAD: + return "Prebuilt Shader Download"; default: return "No Name"; } diff --git a/include/igcl_api.h b/include/igcl_api.h index 2291a07..39f115f 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -1513,6 +1513,7 @@ typedef enum _ctl_3d_feature_t CTL_3D_FEATURE_GLOBAL_OR_PER_APP = 15, ///< Set global settings or per application settings CTL_3D_FEATURE_LOW_LATENCY = 16, ///< Low latency mode. Contains generic enum type fields CTL_3D_FEATURE_FRAME_GENERATION = 17, ///< Frame Generation + CTL_3D_FEATURE_PREBUILT_SHADER_DOWNLOAD = 18, ///< Download prebuilt shaders. Contains generic bool type fields CTL_3D_FEATURE_MAX } ctl_3d_feature_t; From 81b306e0901b63af215f7704b9dcc1dd350efa77 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Mon, 3 Nov 2025 21:21:07 -0800 Subject: [PATCH 22/26] Updated version to v257 --- .../DisplaySettings_Sample_App.cpp | 101 ++++++++++++++++++ Samples/FirmwareApi/FirmwareApiApp.cpp | 2 +- .../Telemetry_Samples/Sample_TelemetryAPP.cpp | 2 +- include/igcl_api.h | 4 + 4 files changed, 107 insertions(+), 2 deletions(-) diff --git a/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp b/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp index ab562b7..1fa23b3 100644 --- a/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp +++ b/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp @@ -325,6 +325,103 @@ ctl_result_t TestToGetSetSourceTonemapping(ctl_display_output_handle_t hDisplayO return Result; } +/*************************************************************** + * @brief + * Sample test for Get/Set Audio settings + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestToGetSetAudioEndpoint(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_display_settings_t AppliedDisplaySettings = { 0 }; + ctl_display_settings_t NewDisplaySettings = { 0 }; + bool IsControllable, IsSupported = FALSE; + + // GET CALL + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Audio settings GET CALL)"); + + IsControllable = (CTL_DISPLAY_SETTING_FLAG_AUDIO & AppliedDisplaySettings.ControllableFlags) ? TRUE : FALSE; + IsSupported = (CTL_DISPLAY_SETTING_FLAG_AUDIO & AppliedDisplaySettings.SupportedFlags) ? TRUE : FALSE; + + if (FALSE == IsControllable) + { + printf("Get/Set Audio settings are not controllable \n"); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + + if (FALSE == IsSupported) + { + printf("Get/Set Audio is not supported \n"); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + + printf("\n Current Audio settings are %d \n", AppliedDisplaySettings.AudioSettings); + + // SET CALL To disable audio endpoint + NewDisplaySettings.Version = API_VERSION; + NewDisplaySettings.Size = sizeof(ctl_display_settings_t); + NewDisplaySettings.Set = TRUE; + + NewDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_AUDIO; + NewDisplaySettings.AudioSettings = CTL_DISPLAY_SETTING_AUDIO_DISABLED; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &NewDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Audio settings SET CALL)"); + + // GET CALL + AppliedDisplaySettings = { 0 }; + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Audio settings GET CALL)"); + printf("\n Current Audio settings post SET call %d \n", AppliedDisplaySettings.AudioSettings); + + if (AppliedDisplaySettings.AudioSettings != NewDisplaySettings.AudioSettings) + { + APP_LOG_ERROR("Current and Applied AudioSettings mismatched: %d, %d", AppliedDisplaySettings.AudioSettings, NewDisplaySettings.AudioSettings); + } + + // SET CALL To enable back audio endpoint + NewDisplaySettings = { 0 }; + NewDisplaySettings.Version = API_VERSION; + NewDisplaySettings.Size = sizeof(ctl_display_settings_t); + NewDisplaySettings.Set = TRUE; + + NewDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_AUDIO; + NewDisplaySettings.AudioSettings = CTL_DISPLAY_SETTING_AUDIO_DEFAULT; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &NewDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Audio settings SET CALL)"); + + // GET CALL + AppliedDisplaySettings = { 0 }; + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (Audio settings GET CALL)"); + printf("\n Current Audio settings post SET call %d \n", AppliedDisplaySettings.AudioSettings); + + if (AppliedDisplaySettings.AudioSettings != NewDisplaySettings.AudioSettings) + { + APP_LOG_ERROR("Current and Applied AudioSettings mismatched: %d, %d", AppliedDisplaySettings.AudioSettings, NewDisplaySettings.AudioSettings); + } + +Exit: + return Result; +} + /*************************************************************** * @brief EnumerateDisplayHandles * Only for demonstration purpose, API is called for each of the display output handle in below snippet. @@ -375,6 +472,10 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput // Get/Set HDR10+ Source Tonemapping Flag Result = TestToGetSetSourceTonemapping(hDisplayOutput[DisplayIndex]); STORE_AND_RESET_ERROR(Result); + + // Get/Set Audio Endpoint + Result = TestToGetSetAudioEndpoint(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); } Exit: diff --git a/Samples/FirmwareApi/FirmwareApiApp.cpp b/Samples/FirmwareApi/FirmwareApiApp.cpp index 4f119f4..693c30e 100644 --- a/Samples/FirmwareApi/FirmwareApiApp.cpp +++ b/Samples/FirmwareApi/FirmwareApiApp.cpp @@ -56,7 +56,7 @@ int main() ctl_init_args_t CtlInitArgs; ctl_api_handle_t hAPIHandle; CtlInitArgs.AppVersion = CTL_MAKE_VERSION(CTL_IMPL_MAJOR_VERSION, CTL_IMPL_MINOR_VERSION); - CtlInitArgs.flags = CTL_INIT_FLAG_USE_LEVEL_ZERO; + CtlInitArgs.flags = CTL_INIT_FLAG_USE_LEVEL_ZERO | CTL_INIT_FLAG_IGSC_FUL; CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; diff --git a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp index 87ceaed..8197a24 100644 --- a/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp +++ b/Samples/Telemetry_Samples/Sample_TelemetryAPP.cpp @@ -1544,7 +1544,7 @@ int main() ctl_init_args_t CtlInitArgs; ctl_api_handle_t hAPIHandle; CtlInitArgs.AppVersion = CTL_MAKE_VERSION(CTL_IMPL_MAJOR_VERSION, CTL_IMPL_MINOR_VERSION); - CtlInitArgs.flags = CTL_INIT_FLAG_USE_LEVEL_ZERO; + CtlInitArgs.flags = CTL_INIT_FLAG_USE_LEVEL_ZERO | CTL_INIT_FLAG_IGSC_FUL; CtlInitArgs.Size = sizeof(CtlInitArgs); CtlInitArgs.Version = 0; ZeroMemory(&CtlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); diff --git a/include/igcl_api.h b/include/igcl_api.h index 39f115f..06f3571 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -120,6 +120,9 @@ typedef enum _ctl_init_flag_t { CTL_INIT_FLAG_USE_LEVEL_ZERO = CTL_BIT(0), ///< Use Level0 or not. This is usually required for telemetry, ///< performance, frequency related APIs + CTL_INIT_FLAG_IGSC_FUL = CTL_BIT(1), ///< Enable IGSC(Intel Graphics System Firmware Update Library) full + ///< functionality mode, which may include advanced graphics and compute + ///< capabilities CTL_INIT_FLAG_MAX = 0x80000000 } ctl_init_flag_t; @@ -392,6 +395,7 @@ typedef enum _ctl_result_t CTL_RESULT_ERROR_UNKNOWN = 0x4000FFFF, ///< Unknown or internal error CTL_RESULT_ERROR_RETRY_OPERATION = 0x40010000, ///< Operation failed, retry previous operation again CTL_RESULT_ERROR_IGSC_LOADER = 0x40010001, ///< IGSC library loader not found + CTL_RESULT_ERROR_RESTRICTED_APPLICATION = 0x40010002, ///< Unsupported application CTL_RESULT_ERROR_GENERIC_END = 0x4000FFFF, ///< "Generic error code end value, not to be used ///< " CTL_RESULT_ERROR_CORE_START = 0x44000000, ///< Core error code starting value, not to be used From a06dbe17e6cfa7dba4a92996e81de1d104fc8769 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Wed, 24 Dec 2025 02:19:22 -0800 Subject: [PATCH 23/26] Updated version to v262 --- .../DisplaySettings_Sample_App.cpp | 98 +++++++- Samples/Generic_Sample/Sample_ControlAPP.cpp | 11 +- .../I2C_AUX_Samples/I2C_AUX_Sample_App.cpp | 221 ++++++++++++++++++ .../Sample_OverclockAPP.cpp | 2 +- Samples/inc/GenericIGCLApp.h | 59 +++++ Source/cApiWrapper.cpp | 3 +- include/igcl_api.h | 7 +- 7 files changed, 390 insertions(+), 11 deletions(-) diff --git a/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp b/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp index 1fa23b3..f2f10c3 100644 --- a/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp +++ b/Samples/DisplaySettings/DisplaySettings_Sample_App.cpp @@ -325,6 +325,79 @@ ctl_result_t TestToGetSetSourceTonemapping(ctl_display_output_handle_t hDisplayO return Result; } +/*************************************************************** + * @brief + * Sample test for HDR10+ + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestHDR10Plus(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_display_settings_t AppliedDisplaySettings = { 0 }; + ctl_display_settings_t NewDisplaySettings = { 0 }; + bool IsControllable, IsSupported = FALSE; + + // GET CALL + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + AppliedDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY | CTL_DISPLAY_SETTING_FLAG_SOURCE_TM; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (LowLatency GET CALL)"); + + // LowLatency + IsControllable = (CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY & AppliedDisplaySettings.ControllableFlags) ? TRUE : FALSE; + IsSupported = (CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY & AppliedDisplaySettings.SupportedFlags) ? TRUE : FALSE; + + if ((FALSE == IsControllable) || (FALSE == IsSupported)) + { + APP_LOG_WARN("Get/Set LowLatency is not supported/controllable = %d/%d", IsSupported, IsControllable); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + APP_LOG_INFO(" Current Applied LowLatency is %d ", AppliedDisplaySettings.LowLatency); + + // SourceTM + IsControllable = (CTL_DISPLAY_SETTING_FLAG_SOURCE_TM & AppliedDisplaySettings.ControllableFlags) ? TRUE : FALSE; + IsSupported = (CTL_DISPLAY_SETTING_FLAG_SOURCE_TM & AppliedDisplaySettings.SupportedFlags) ? TRUE : FALSE; + + if ((FALSE == IsControllable) || (FALSE == IsSupported)) + { + APP_LOG_WARN("Get/Set SourceTM is not supported/controllable = %d/%d. Ensure HDR mode is enabled in OS settings.", IsSupported, IsControllable); + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + goto Exit; + } + APP_LOG_INFO(" Current Applied SourceTM is %d ", AppliedDisplaySettings.SourceTM); + + // CALL TO ENABLE HDR10+ LOW_LATENCY + NewDisplaySettings.Version = API_VERSION; + NewDisplaySettings.Size = sizeof(ctl_display_settings_t); + NewDisplaySettings.Set = TRUE; + NewDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY | CTL_DISPLAY_SETTING_FLAG_SOURCE_TM; + NewDisplaySettings.LowLatency = CTL_DISPLAY_SETTING_LOW_LATENCY_ENABLED; + NewDisplaySettings.SourceTM = CTL_DISPLAY_SETTING_SOURCETM_ENABLED; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &NewDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (LowLatency_SourceTM SET CALL)"); + + // GET CALL + AppliedDisplaySettings = { 0 }; + AppliedDisplaySettings.Version = API_VERSION; + AppliedDisplaySettings.Size = sizeof(ctl_display_settings_t); + AppliedDisplaySettings.Set = FALSE; + AppliedDisplaySettings.ValidFlags = CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY | CTL_DISPLAY_SETTING_FLAG_SOURCE_TM; + + Result = ctlGetSetDisplaySettings(hDisplayOutput, &AppliedDisplaySettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetDisplaySettings (LowLatency_SourceTM GET CALL)"); + APP_LOG_INFO(" Current LowLatency is %d ", AppliedDisplaySettings.LowLatency); + APP_LOG_INFO(" Current SourceTM is %d ", AppliedDisplaySettings.SourceTM); + +Exit: + return Result; +} + /*************************************************************** * @brief * Sample test for Get/Set Audio settings @@ -465,13 +538,26 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput Result = TestToGetSetContentType(hDisplayOutput[DisplayIndex]); STORE_AND_RESET_ERROR(Result); - // Get/Set HDR10+ Low Latency Flag - Result = TestToGetSetLowLatency(hDisplayOutput[DisplayIndex]); - STORE_AND_RESET_ERROR(Result); + if (DisplayProperties.FeatureSupportedFlags & CTL_STD_DISPLAY_FEATURE_FLAG_HDR10_PLUS_CERTIFIED) + { + APP_LOG_INFO("HDR10+ Certified Display is detected"); - // Get/Set HDR10+ Source Tonemapping Flag - Result = TestToGetSetSourceTonemapping(hDisplayOutput[DisplayIndex]); - STORE_AND_RESET_ERROR(Result); + // Get/Set HDR10+ Low Latency & SourceTM Flag + Result = TestHDR10Plus(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + } + else + { + APP_LOG_INFO("HDR10+ Certified Display not detected"); + + // Get/Set HDR10+ Low Latency Flag + Result = TestToGetSetLowLatency(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + + // Get/Set HDR10+ Source Tonemapping Flag + Result = TestToGetSetSourceTonemapping(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + } // Get/Set Audio Endpoint Result = TestToGetSetAudioEndpoint(hDisplayOutput[DisplayIndex]); diff --git a/Samples/Generic_Sample/Sample_ControlAPP.cpp b/Samples/Generic_Sample/Sample_ControlAPP.cpp index c532929..b4ac3fd 100644 --- a/Samples/Generic_Sample/Sample_ControlAPP.cpp +++ b/Samples/Generic_Sample/Sample_ControlAPP.cpp @@ -423,6 +423,13 @@ ctl_result_t CtlGetDisplayPropertiesTest(ctl_device_adapter_handle_t hAdapter, c std::cout << "DisplayConfigFlags is " << pStdisplayproperties->DisplayConfigFlags << "\n"; std::cout << "Is Display Active : " << Isdisplay_active << "\n"; std::cout << "Is Display Attached : " << Isdisplay_attached << "\n"; + + std::cout << "Supported features\n"; + PrintStdDisplayFeatureFlags(pStdisplayproperties->FeatureSupportedFlags); + PrintIntelDisplayFeatureFlags(pStdisplayproperties->AdvancedFeatureSupportedFlags); + std::cout << "Enabled features\n "; + PrintStdDisplayFeatureFlags(pStdisplayproperties->FeatureEnabledFlags); + PrintIntelDisplayFeatureFlags(pStdisplayproperties->AdvancedFeatureEnabledFlags); } pStdisplayproperties->DisplayConfigFlags = 0; pStdisplayproperties->Os_display_encoder_handle.WindowsDisplayEncoderID = 0; @@ -926,8 +933,8 @@ ctl_result_t CtlAdapterTesting(ctl_device_adapter_handle_t *hDevices, uint32_t A if (StDeviceAdapterProperties.pDeviceID != nullptr) { - free(StDeviceAdapterProperties.pDeviceID); - StDeviceAdapterProperties.pDeviceID = nullptr; + free(StDeviceAdapterProperties.pDeviceID); + StDeviceAdapterProperties.pDeviceID = nullptr; } return Result; diff --git a/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp b/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp index 4dd9d5c..5a382c4 100644 --- a/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp +++ b/Samples/I2C_AUX_Samples/I2C_AUX_Sample_App.cpp @@ -138,6 +138,211 @@ ctl_result_t TestI2CAUXAccess(ctl_display_output_handle_t hDisplayOutput) return Result; } +/*************************************************************** + * @brief TestI2CAccessWithDriverOverrideFlagsForMultipleReadTransactions + * Reference code to show how to use the I2C driver flags for multiple read transactions for HDMI displays + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestI2CAccessWithDriverOverrideFlagsForMultipleReadTransactions(ctl_display_output_handle_t hDisplayOutput) +{ +#define READ_DATA_SIZE 11 // the total read data size to +#define READ_SIZE_LIMIT 2 // the read data size limit for each I2C read transaction + + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_i2c_access_args_t I2CArgs = { 0 }; // I2C Access + uint32_t ReadDataLeft = 0; + uint32_t ReadDataSent = 0; + uint32_t ReadDataSizeLimit = 0; + bool IsFirstReadTransaction = TRUE; + + // I2C WRITE : 82 01 10 AC at address 6E and subaddress 51 + // If we write these BYTEs ( 82 01 10 AC) to address 6E and + // subaddress 51, it should update the current brightness to the 10th + // byte at address 6E and subaddress 51. One can verify by changing + // panel brightness from panel buttons, writing to address 6E + // and subaddress 51 ( 82 01 10 AC), and then reading 10th byte at + // address 6E and subaddress 51. Here is an example of an 11 byte output: + // 6E 88 02 00 10 00 00 64 00 19 D9. The 10th byte value is the current brightness value of the + // panel. To confirm whether this value is correct or not, convert the Hex + // value to Decimal. In this example, the 10th byte is 0x19, which represents 25% panel brightness. + I2CArgs.Size = sizeof(ctl_i2c_access_args_t); + I2CArgs.OpType = CTL_OPERATION_TYPE_WRITE; + I2CArgs.Address = 0x6E; // Address used for demonstration purpose + I2CArgs.Offset = 0x51; // Offset used for demonstration purpose + I2CArgs.DataSize = 4; + I2CArgs.Data[0] = 0x82; + I2CArgs.Data[1] = 0x01; + I2CArgs.Data[2] = 0x10; + I2CArgs.Data[3] = 0xAC; + + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + APP_LOG_INFO("I2C Write Test using I2C driver override flags for multiple read transactions"); + + Result = ctlI2CAccess(hDisplayOutput, &I2CArgs); + + if (CTL_RESULT_SUCCESS != Result) + { + APP_LOG_ERROR("ctlI2CAccess for I2C write returned failure code: 0x%X", Result); + STORE_AND_RESET_ERROR(Result); + } + + // I2C READ : 82 01 10 AC at address 6E and subaddress 51 + APP_LOG_INFO("I2C Read Transaction Test using I2C driver override flags for multiple read transactions"); + + ZeroMemory(&I2CArgs, sizeof(I2CArgs)); + I2CArgs.Size = sizeof(ctl_i2c_access_args_t); + I2CArgs.OpType = CTL_OPERATION_TYPE_READ; + I2CArgs.Address = 0x6E; // Address used for demonstration purpose + I2CArgs.Offset = 0x51; // Offset used for demonstration purpose + I2CArgs.DataSize = READ_SIZE_LIMIT; + + I2CArgs.Flags |= CTL_I2C_FLAG_DRIVER_OVERRIDE; // must be enabled to use the driver override I2C flags + I2CArgs.Flags |= CTL_I2C_FLAG_SPEED_BIT_BASH; // bit bash flag is required for driver override feature + + ReadDataLeft = READ_DATA_SIZE; + ReadDataSizeLimit = READ_SIZE_LIMIT; + ReadDataSent = 0; + IsFirstReadTransaction = TRUE; + + for (uint32_t i = 0; ReadDataLeft > 0; i++) + { + I2CArgs.Offset = ReadDataSent; + + if (TRUE == IsFirstReadTransaction) + { + if (ReadDataLeft <= ReadDataSizeLimit) // single read transaction: enable start and stop + { + APP_LOG_INFO("Single Transaction"); + I2CArgs.DataSize = ReadDataLeft; + I2CArgs.Flags |= CTL_I2C_FLAG_START; + I2CArgs.Flags |= CTL_I2C_FLAG_STOP; + } + else // first read transaction: enable start, disable stop + { + APP_LOG_INFO("First Transaction: %i", i + 1); + I2CArgs.DataSize = ReadDataSizeLimit; + I2CArgs.Flags |= CTL_I2C_FLAG_START; + I2CArgs.Flags &= ~CTL_I2C_FLAG_STOP; + } + + IsFirstReadTransaction = FALSE; + } + else + { + if (ReadDataLeft <= ReadDataSizeLimit) // last read transaction: disable start, enable stop + { + APP_LOG_INFO("Last Transaction: %i", i + 1); + I2CArgs.DataSize = ReadDataLeft; + I2CArgs.Flags &= ~CTL_I2C_FLAG_START; + I2CArgs.Flags |= CTL_I2C_FLAG_STOP; + } + else // middle range read transaction: disable start and stop + { + APP_LOG_INFO("Middle Range Transaction: %i", i + 1); + I2CArgs.Flags &= ~CTL_I2C_FLAG_START; + I2CArgs.Flags &= ~CTL_I2C_FLAG_STOP; + } + } + + memset(I2CArgs.Data, 0xFF, I2CArgs.DataSize); // Clear the data buffer before reading + + Result = ctlI2CAccess(hDisplayOutput, &I2CArgs); + LOG_AND_EXIT_ON_ERROR(Result, "ctlI2CAccess for I2C Read Transaction Test using I2C driver override flags"); + + // Print the data + for (uint32_t j = 0; j < I2CArgs.DataSize; j++) + { + APP_LOG_INFO("Read data[%d] = : 0x%X", j, I2CArgs.Data[j]); + } + + ReadDataSent += I2CArgs.DataSize; + ReadDataLeft -= I2CArgs.DataSize; + } + +Exit: + return Result; +} + +/*************************************************************** + * @brief TestI2CAccessWithRestartDriverOverrideFlag + * Reference code to show how to use the I2C Restart driver override flag for HDMI displays + * @param hDisplayOutput + * @return ctl_result_t + ***************************************************************/ +ctl_result_t TestI2CAccessWithRestartDriverOverrideFlag(ctl_display_output_handle_t hDisplayOutput) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_i2c_access_args_t I2CArgs = { 0 }; // I2C Access + + // I2C WRITE : 82 01 10 AC at address 6E and subaddress 51 + // If we write these BYTEs ( 82 01 10 AC) to address 6E and + // subaddress 51, it should update the current brightness to the 10th + // byte at address 6E and subaddress 51. One can verify by changing + // panel brightness from panel buttons, writing to address 6E + // and subaddress 51 ( 82 01 10 AC), and then reading 10th byte at + // address 6E and subaddress 51. Here is an example of an 11 byte output: + // 6E 88 02 00 10 00 00 64 00 19 D9. The 10th byte value is the current brightness value of the + // panel. To confirm whether this value is correct or not, convert the Hex + // value to Decimal. In this example, the 10th byte is 0x19, which represents 25% panel brightness. + I2CArgs.Size = sizeof(ctl_i2c_access_args_t); + I2CArgs.OpType = CTL_OPERATION_TYPE_WRITE; + I2CArgs.Address = 0x6E; // Address used for demonstration purpose + I2CArgs.Offset = 0x51; // Offset used for demonstration purpose + I2CArgs.DataSize = 4; + I2CArgs.Data[0] = 0x82; + I2CArgs.Data[1] = 0x01; + I2CArgs.Data[2] = 0x10; + I2CArgs.Data[3] = 0xAC; + + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + APP_LOG_INFO("I2C Write Test using I2C Restart driver override flag for read"); + + I2CArgs.Flags |= CTL_I2C_FLAG_DRIVER_OVERRIDE; // must be enabled to use the driver override I2C flags + I2CArgs.Flags |= CTL_I2C_FLAG_SPEED_BIT_BASH; // bit bash flag is required for driver override feature + I2CArgs.Flags |= CTL_I2C_FLAG_START; // enable start flag for the write operation + + Result = ctlI2CAccess(hDisplayOutput, &I2CArgs); + + if (CTL_RESULT_SUCCESS != Result) + { + APP_LOG_ERROR("ctlI2CAccess for I2C write returned failure code: 0x%X", Result); + STORE_AND_RESET_ERROR(Result); + } + + // I2C READ : 82 01 10 AC at address 6E and subaddress 51 + APP_LOG_INFO("I2C Read Transaction Test using I2C Restart driver override flag for read"); + + ZeroMemory(&I2CArgs, sizeof(I2CArgs)); + I2CArgs.Size = sizeof(ctl_i2c_access_args_t); + I2CArgs.OpType = CTL_OPERATION_TYPE_READ; + I2CArgs.Address = 0x6E; // Address used for demonstration purpose + I2CArgs.Offset = 0x51; // Offset used for demonstration purpose + I2CArgs.DataSize = 11; + + // Perform I2C repeated start transaction for read by enabling Restart flag + I2CArgs.Flags |= CTL_I2C_FLAG_DRIVER_OVERRIDE; // must be enabled to use the driver override I2C flags + I2CArgs.Flags |= CTL_I2C_FLAG_SPEED_BIT_BASH; // bit bash flag is required for driver override feature + I2CArgs.Flags |= CTL_I2C_FLAG_RESTART; // enable restart flag for the read operation + I2CArgs.Flags |= CTL_I2C_FLAG_STOP; // issue a stop after the read operation is completed + + memset(I2CArgs.Data, 0xFF, I2CArgs.DataSize); // Clear the data buffer before reading + + Result = ctlI2CAccess(hDisplayOutput, &I2CArgs); + LOG_AND_EXIT_ON_ERROR(Result, "ctlI2CAccess for I2C read with Restart flag"); + + // Print the data + for (uint32_t j = 0; j < I2CArgs.DataSize; j++) + { + APP_LOG_INFO("Read data[%d] = : 0x%X", j, I2CArgs.Data[j]); + } + +Exit: + return Result; +} + /*************************************************************** * @brief Tests I2C Access on enumerated Pin Pairs. * Reference code to use ctlI2CAccessOnPinPair API @@ -241,6 +446,22 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput Result = TestI2CAUXAccess(hDisplayOutput[DisplayIndex]); STORE_AND_RESET_ERROR(Result); + + ctl_adapter_display_encoder_properties_t stDisplayEncoderProperties = {}; + stDisplayEncoderProperties.Size = sizeof(ctl_adapter_display_encoder_properties_t); + + Result = ctlGetAdaperDisplayEncoderProperties(hDisplayOutput[DisplayIndex], &stDisplayEncoderProperties); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetAdaperDisplayEncoderProperties"); + + // Currently the driver override flags are limited to HDMI only + if (CTL_DISPLAY_OUTPUT_TYPES_HDMI == stDisplayEncoderProperties.Type) + { + Result = TestI2CAccessWithDriverOverrideFlagsForMultipleReadTransactions(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + + Result = TestI2CAccessWithRestartDriverOverrideFlag(hDisplayOutput[DisplayIndex]); + STORE_AND_RESET_ERROR(Result); + } } Exit: diff --git a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp index b32e200..39918ec 100644 --- a/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp +++ b/Samples/Overclocking_Sample/Sample_OverclockAPP.cpp @@ -582,7 +582,7 @@ void OverclockTemperatureLimit(ctl_device_adapter_handle_t hDAhandle) // Step 3: Writing New Temperature Limit by increasing it by (Step * 5.0) from min value // Input Temperature Limit units are given in ctl_oc_properties_t::temperatureLimit::units returned from ctlOverclockGetProperties() - // Currently ctl_oc_properties_t::temperatureLimit::units for Alchemist are CTL_UNITS_TEMPERATURE_CELSIUS units, for Battlemage are CTL_UNITS_PERCENT units + // Currently ctl_oc_properties_t::temperatureLimit::units for Alchemist and BMG G31 are CTL_UNITS_TEMPERATURE_CELSIUS units, for Battlemage (excluding G31) are CTL_UNITS_PERCENT units CurrentTemperatureLimit = OcProperties.temperatureLimit.min + (OcProperties.temperatureLimit.step * 5.0); Status = ctlOverclockTemperatureLimitSetV2(hDAhandle, CurrentTemperatureLimit); if (Status != ctl_result_t::CTL_RESULT_SUCCESS) diff --git a/Samples/inc/GenericIGCLApp.h b/Samples/inc/GenericIGCLApp.h index d99de21..b7d1012 100644 --- a/Samples/inc/GenericIGCLApp.h +++ b/Samples/inc/GenericIGCLApp.h @@ -445,3 +445,62 @@ inline void Print3DFeatureDetail(ctl_3d_feature_details_t *pFeatureDetails) } } } + +// Helper function to print ctl_std_display_feature_flags_t flags +void PrintStdDisplayFeatureFlags(ctl_std_display_feature_flags_t flags) +{ + printf("ctl_std_display_feature_flags_t: 0x%X\n", flags); + + // Example flag values, replace/add with actual flag definitions as needed + struct FlagInfo + { + ctl_std_display_feature_flags_t value; + const char *name; + }; + + static const FlagInfo flagInfos[] = { + { 0x00000001, "CTL_STD_DISPLAY_FEATURE_FLAG_HDCP" }, + { 0x00000002, "CTL_STD_DISPLAY_FEATURE_FLAG_HD_AUDIO" }, + { 0x00000004, "CTL_STD_DISPLAY_FEATURE_FLAG_PSR" }, + { 0x00000008, "CTL_STD_DISPLAY_FEATURE_FLAG_ADAPTIVESYNC_VRR" }, + { 0x00000010, "CTL_STD_DISPLAY_FEATURE_FLAG_VESA_COMPRESSION" }, + { 0x00000020, "CTL_STD_DISPLAY_FEATURE_FLAG_HDR" }, + { 0x00000040, "CTL_STD_DISPLAY_FEATURE_FLAG_HDMI_QMS" }, + { 0x00000080, "CTL_STD_DISPLAY_FEATURE_FLAG_HDR10_PLUS_CERTIFIED" }, + { 0x00000100, "CTL_STD_DISPLAY_FEATURE_FLAG_VESA_HDR_CERTIFIED" }, + // Add more flag definitions here as needed + }; + + for (const auto &info : flagInfos) + { + if (flags & info.value) + { + printf(" %s\n", info.name); + } + } +} + +void PrintIntelDisplayFeatureFlags(ctl_intel_display_feature_flags_t flags) +{ + printf("ctl_intel_display_feature_flags_t: 0x%X\n", flags); + // Example flag values, replace/add with actual flag definitions as needed + struct FlagInfo + { + ctl_intel_display_feature_flags_t value; + const char *name; + }; + static const FlagInfo flagInfos[] = { + { 0x00000001, "CTL_INTEL_DISPLAY_FEATURE_FLAG_DPST" }, + { 0x00000002, "CTL_INTEL_DISPLAY_FEATURE_FLAG_LACE" }, + { 0x00000004, "CTL_INTEL_DISPLAY_FEATURE_FLAG_DRRS" }, + { 0x00000008, "CTL_INTEL_DISPLAY_FEATURE_FLAG_ARC_ADAPTIVE_SYNC_CERTIFIED" }, + // Add more flag definitions here as needed + }; + for (const auto &info : flagInfos) + { + if (flags & info.value) + { + printf(" %s\n", info.name); + } + } +} diff --git a/Source/cApiWrapper.cpp b/Source/cApiWrapper.cpp index 5af1d6c..71803a7 100644 --- a/Source/cApiWrapper.cpp +++ b/Source/cApiWrapper.cpp @@ -890,7 +890,8 @@ ctlSetCurrentSharpness( * @brief I2C Access * * @details -* - Interface to access I2C using display handle as identifier. +* - Interface to access I2C using display handle as identifier. I2C +* driver override flags are supported only for HDMI displays. * * @returns * - CTL_RESULT_SUCCESS diff --git a/include/igcl_api.h b/include/igcl_api.h index 06f3571..7b1babc 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -2540,6 +2540,10 @@ typedef enum _ctl_i2c_flag_t CTL_I2C_FLAG_SPEED_FAST = CTL_BIT(5), ///< If no Speed Flag is set, defaults to Best Option possible. CTL_I2C_FLAG_SPEED_BIT_BASH = CTL_BIT(6), ///< Uses Slower access using SW bit bashing method. If no Speed Flag is ///< set, defaults to Best Option possible. + CTL_I2C_FLAG_DRIVER_OVERRIDE = CTL_BIT(7), ///< If set, overrides the driver I2C flags with those provided by IGCL + CTL_I2C_FLAG_START = CTL_BIT(8), ///< I2C Start driver override flag + CTL_I2C_FLAG_STOP = CTL_BIT(9), ///< I2C Stop driver override flags + CTL_I2C_FLAG_RESTART = CTL_BIT(10), ///< I2C Restart driver override flag CTL_I2C_FLAG_MAX = 0x80000000 } ctl_i2c_flag_t; @@ -2566,7 +2570,8 @@ typedef struct _ctl_i2c_access_args_t /// @brief I2C Access /// /// @details -/// - Interface to access I2C using display handle as identifier. +/// - Interface to access I2C using display handle as identifier. I2C +/// driver override flags are supported only for HDMI displays. /// /// @returns /// - CTL_RESULT_SUCCESS From 1c2b0b8257d496a82cd84813018961bfc43b74a0 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Wed, 21 Jan 2026 06:01:44 -0800 Subject: [PATCH 24/26] Updated version to v268 --- Samples/3D_Feature_Samples/CMakeLists.txt | 2 +- Samples/Color_Samples/CMakeLists.txt | 2 +- Samples/CombinedDisplay/CMakeLists.txt | 2 +- Samples/Custom_Mode_Samples/CMakeLists.txt | 2 +- Samples/DisplayGenlock/CMakeLists.txt | 2 +- Samples/DisplaySettings/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- Samples/Edid_Management_Sample/CMakeLists.txt | 2 +- Samples/FirmwareApi/CMakeLists.txt | 2 +- Samples/Generic_Sample/CMakeLists.txt | 2 +- Samples/I2C_AUX_Samples/CMakeLists.txt | 2 +- Samples/IntelArcSync/CMakeLists.txt | 2 +- Samples/Media_Samples/CMakeLists.txt | 2 +- Samples/Overclocking_Sample/CMakeLists.txt | 2 +- .../Panel_descriptor_Samples/CMakeLists.txt | 2 +- Samples/Power_Feature_Samples/CMakeLists.txt | 2 +- Samples/Scaling_Samples/CMakeLists.txt | 2 +- Samples/ScdcRead/CMakeLists.txt | 2 +- Samples/Telemetry_Samples/CMakeLists.txt | 2 +- Samples/UBRR_Sample/CMakeLists.txt | 2 +- Source/cApiWrapper.cpp | 129 ----------------- include/igcl_api.h | 133 +----------------- 22 files changed, 24 insertions(+), 278 deletions(-) diff --git a/Samples/3D_Feature_Samples/CMakeLists.txt b/Samples/3D_Feature_Samples/CMakeLists.txt index d784487..d76dbe4 100644 --- a/Samples/3D_Feature_Samples/CMakeLists.txt +++ b/Samples/3D_Feature_Samples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME 3D_Feature_Samples) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(3D_Feature_Samples VERSION 1.0) diff --git a/Samples/Color_Samples/CMakeLists.txt b/Samples/Color_Samples/CMakeLists.txt index 811cf47..a39564b 100644 --- a/Samples/Color_Samples/CMakeLists.txt +++ b/Samples/Color_Samples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Color_Samples) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Color_Samples VERSION 1.0) diff --git a/Samples/CombinedDisplay/CMakeLists.txt b/Samples/CombinedDisplay/CMakeLists.txt index 332cf0f..d07c21c 100644 --- a/Samples/CombinedDisplay/CMakeLists.txt +++ b/Samples/CombinedDisplay/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME CombinedDisplay) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(CombinedDisplay VERSION 1.0) diff --git a/Samples/Custom_Mode_Samples/CMakeLists.txt b/Samples/Custom_Mode_Samples/CMakeLists.txt index f38588d..af0e346 100644 --- a/Samples/Custom_Mode_Samples/CMakeLists.txt +++ b/Samples/Custom_Mode_Samples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Custom_Mode_Samples) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Custom_Mode_Samples VERSION 1.0) diff --git a/Samples/DisplayGenlock/CMakeLists.txt b/Samples/DisplayGenlock/CMakeLists.txt index c6de010..545b930 100644 --- a/Samples/DisplayGenlock/CMakeLists.txt +++ b/Samples/DisplayGenlock/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME DisplayGenlock) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(DisplayGenlock VERSION 1.0) diff --git a/Samples/DisplaySettings/CMakeLists.txt b/Samples/DisplaySettings/CMakeLists.txt index 43ce6d4..d1900f1 100644 --- a/Samples/DisplaySettings/CMakeLists.txt +++ b/Samples/DisplaySettings/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME DisplaySettings) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(DisplaySettings VERSION 1.0) diff --git a/Samples/DynamicContrastEnhancement_Sample/CMakeLists.txt b/Samples/DynamicContrastEnhancement_Sample/CMakeLists.txt index 7cabf22..858c16a 100644 --- a/Samples/DynamicContrastEnhancement_Sample/CMakeLists.txt +++ b/Samples/DynamicContrastEnhancement_Sample/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME DynamicContrastEnhancement_Sample) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(DynamicContrastEnhancement_Sample VERSION 1.0) diff --git a/Samples/Edid_Management_Sample/CMakeLists.txt b/Samples/Edid_Management_Sample/CMakeLists.txt index 35ad7b8..878ea6f 100644 --- a/Samples/Edid_Management_Sample/CMakeLists.txt +++ b/Samples/Edid_Management_Sample/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Edid_Management_Sample) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Edid_Management_Sample VERSION 1.0) diff --git a/Samples/FirmwareApi/CMakeLists.txt b/Samples/FirmwareApi/CMakeLists.txt index 7e9f7fb..68b3d74 100644 --- a/Samples/FirmwareApi/CMakeLists.txt +++ b/Samples/FirmwareApi/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME FirmwareApi) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(FirmwareApi VERSION 1.0) diff --git a/Samples/Generic_Sample/CMakeLists.txt b/Samples/Generic_Sample/CMakeLists.txt index f8ed9e2..4647c49 100644 --- a/Samples/Generic_Sample/CMakeLists.txt +++ b/Samples/Generic_Sample/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Generic_Sample) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Generic_Sample VERSION 1.0) diff --git a/Samples/I2C_AUX_Samples/CMakeLists.txt b/Samples/I2C_AUX_Samples/CMakeLists.txt index e4a1316..c21b579 100644 --- a/Samples/I2C_AUX_Samples/CMakeLists.txt +++ b/Samples/I2C_AUX_Samples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME I2C_AUX_Samples) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(I2C_AUX_Samples VERSION 1.0) diff --git a/Samples/IntelArcSync/CMakeLists.txt b/Samples/IntelArcSync/CMakeLists.txt index de6c3fd..e6339bb 100644 --- a/Samples/IntelArcSync/CMakeLists.txt +++ b/Samples/IntelArcSync/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME IntelArcSync) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(IntelArcSync VERSION 1.0) diff --git a/Samples/Media_Samples/CMakeLists.txt b/Samples/Media_Samples/CMakeLists.txt index b163552..eec053c 100644 --- a/Samples/Media_Samples/CMakeLists.txt +++ b/Samples/Media_Samples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Media_Samples) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Media_Samples VERSION 1.0) diff --git a/Samples/Overclocking_Sample/CMakeLists.txt b/Samples/Overclocking_Sample/CMakeLists.txt index 0f10896..331fa10 100644 --- a/Samples/Overclocking_Sample/CMakeLists.txt +++ b/Samples/Overclocking_Sample/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Overclocking_Sample) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Overclocking_Sample VERSION 1.0) diff --git a/Samples/Panel_descriptor_Samples/CMakeLists.txt b/Samples/Panel_descriptor_Samples/CMakeLists.txt index 114de0c..4f1f3b0 100644 --- a/Samples/Panel_descriptor_Samples/CMakeLists.txt +++ b/Samples/Panel_descriptor_Samples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Panel_descriptor_Samples) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Panel_descriptor_Samples VERSION 1.0) diff --git a/Samples/Power_Feature_Samples/CMakeLists.txt b/Samples/Power_Feature_Samples/CMakeLists.txt index 1fd3ba7..6c2eeec 100644 --- a/Samples/Power_Feature_Samples/CMakeLists.txt +++ b/Samples/Power_Feature_Samples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Power_Feature_Samples) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Power_Feature_Samples VERSION 1.0) diff --git a/Samples/Scaling_Samples/CMakeLists.txt b/Samples/Scaling_Samples/CMakeLists.txt index 462ed52..0a74eab 100644 --- a/Samples/Scaling_Samples/CMakeLists.txt +++ b/Samples/Scaling_Samples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Scaling_Samples) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Scaling_Samples VERSION 1.0) diff --git a/Samples/ScdcRead/CMakeLists.txt b/Samples/ScdcRead/CMakeLists.txt index 05d3fb6..5564a48 100644 --- a/Samples/ScdcRead/CMakeLists.txt +++ b/Samples/ScdcRead/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME ScdcRead) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(ScdcRead VERSION 1.0) diff --git a/Samples/Telemetry_Samples/CMakeLists.txt b/Samples/Telemetry_Samples/CMakeLists.txt index 0f279f6..ca97af6 100644 --- a/Samples/Telemetry_Samples/CMakeLists.txt +++ b/Samples/Telemetry_Samples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME Telemetry_Samples) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(Telemetry_Samples VERSION 1.0) diff --git a/Samples/UBRR_Sample/CMakeLists.txt b/Samples/UBRR_Sample/CMakeLists.txt index 5238e28..b5f0bf0 100644 --- a/Samples/UBRR_Sample/CMakeLists.txt +++ b/Samples/UBRR_Sample/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR) set(TARGET_NAME UBRR_Sample) get_filename_component(ROOT_DIR ../../ ABSOLUTE) project(UBRR_Sample VERSION 1.0) diff --git a/Source/cApiWrapper.cpp b/Source/cApiWrapper.cpp index 71803a7..492a583 100644 --- a/Source/cApiWrapper.cpp +++ b/Source/cApiWrapper.cpp @@ -1771,135 +1771,6 @@ ctlGetIntelArcSyncInfoForMonitor( } -/** -* @brief Enumerate Display MUX Devices on this system across adapters -* -* @details -* - The application enumerates all MUX devices in the system -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hAPIHandle` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pCount` -* + `nullptr == phMuxDevices` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlEnumerateMuxDevices( - ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned - ///< by the CtlInit function - uint32_t* pCount, ///< [in,out][release] pointer to the number of MUX device instances. If - ///< input count is zero, then the api will update the value with the total - ///< number of MUX devices available and return the Count value. If input - ///< count is non-zero, then the api will only retrieve the number of MUX Devices. - ///< If count is larger than the number of MUX devices available, then the - ///< api will update the value with the correct number of MUX devices available. - ctl_mux_output_handle_t* phMuxDevices ///< [out][range(0, *pCount)] array of MUX device instance handles - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnEnumerateMuxDevices_t pfnEnumerateMuxDevices = (ctl_pfnEnumerateMuxDevices_t)GetProcAddress(hinstLibPtr, "ctlEnumerateMuxDevices"); - if (pfnEnumerateMuxDevices) - { - result = pfnEnumerateMuxDevices(hAPIHandle, pCount, phMuxDevices); - } - } - - return result; -} - - -/** -* @brief Get Display Mux properties -* -* @details -* - Get the propeties of the Mux device -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hMuxDevice` -* - CTL_RESULT_ERROR_INVALID_NULL_POINTER -* + `nullptr == pMuxProperties` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlGetMuxProperties( - ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle - ctl_mux_properties_t* pMuxProperties ///< [in,out] MUX device properties - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnGetMuxProperties_t pfnGetMuxProperties = (ctl_pfnGetMuxProperties_t)GetProcAddress(hinstLibPtr, "ctlGetMuxProperties"); - if (pfnGetMuxProperties) - { - result = pfnGetMuxProperties(hMuxDevice, pMuxProperties); - } - } - - return result; -} - - -/** -* @brief Switch Mux output -* -* @details -* - Switches the MUX output -* -* @returns -* - CTL_RESULT_SUCCESS -* - CTL_RESULT_ERROR_UNINITIALIZED -* - CTL_RESULT_ERROR_DEVICE_LOST -* - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -* + `nullptr == hMuxDevice` -* + `nullptr == hInactiveDisplayOutput` -* - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -*/ -ctl_result_t CTL_APICALL -ctlSwitchMux( - ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle - ctl_display_output_handle_t hInactiveDisplayOutput ///< [out] Input selection for this MUX, which if active will drive the - ///< output of this MUX device. This should be one of the display output - ///< handles reported under this MUX device's properties. - ) -{ - ctl_result_t result = CTL_RESULT_ERROR_NOT_INITIALIZED; - - - HINSTANCE hinstLibPtr = GetLoaderHandle(); - - if (NULL != hinstLibPtr) - { - ctl_pfnSwitchMux_t pfnSwitchMux = (ctl_pfnSwitchMux_t)GetProcAddress(hinstLibPtr, "ctlSwitchMux"); - if (pfnSwitchMux) - { - result = pfnSwitchMux(hMuxDevice, hInactiveDisplayOutput); - } - } - - return result; -} - - /** * @brief Get Intel Arc Sync profile * diff --git a/include/igcl_api.h b/include/igcl_api.h index 7b1babc..f1fefb0 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -1195,10 +1195,6 @@ typedef struct _ctl_sw_psr_settings_t ctl_sw_psr_settings_t; /// @brief Forward-declare ctl_intel_arc_sync_monitor_params_t typedef struct _ctl_intel_arc_sync_monitor_params_t ctl_intel_arc_sync_monitor_params_t; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Forward-declare ctl_mux_properties_t -typedef struct _ctl_mux_properties_t ctl_mux_properties_t; - /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ctl_intel_arc_sync_profile_params_t typedef struct _ctl_intel_arc_sync_profile_params_t ctl_intel_arc_sync_profile_params_t; @@ -1656,11 +1652,14 @@ typedef uint32_t ctl_gaming_flip_mode_flags_t; typedef enum _ctl_gaming_flip_mode_flag_t { CTL_GAMING_FLIP_MODE_FLAG_APPLICATION_DEFAULT = CTL_BIT(0), ///< Application Default - CTL_GAMING_FLIP_MODE_FLAG_VSYNC_OFF = CTL_BIT(1), ///< Convert all sync flips to async on the next possible scanline. + CTL_GAMING_FLIP_MODE_FLAG_VSYNC_OFF = CTL_BIT(1), ///< Convert all sync flips to async on the next possible scanline for + ///< Intel Verified application profile. CTL_GAMING_FLIP_MODE_FLAG_VSYNC_ON = CTL_BIT(2),///< Convert all async flips to sync flips. CTL_GAMING_FLIP_MODE_FLAG_SMOOTH_SYNC = CTL_BIT(3), ///< Reduce tearing effect with async flips CTL_GAMING_FLIP_MODE_FLAG_SPEED_FRAME = CTL_BIT(4), ///< Application unaware triple buffering CTL_GAMING_FLIP_MODE_FLAG_CAPPED_FPS = CTL_BIT(5), ///< Limit the game FPS to panel RR + CTL_GAMING_FLIP_MODE_FLAG_VSYNC_OFF_IGNORE_ALLOW_LIST = CTL_BIT(6), ///< Convert all sync flips to async on the next possible scanline without + ///< application filtering. CTL_GAMING_FLIP_MODE_FLAG_MAX = 0x80000000 } ctl_gaming_flip_mode_flag_t; @@ -3778,105 +3777,6 @@ ctlGetIntelArcSyncInfoForMonitor( ctl_intel_arc_sync_monitor_params_t* pIntelArcSyncMonitorParams ///< [in,out][release] Intel Arc Sync params for monitor ); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Handle of a MUX output instance -typedef struct _ctl_mux_output_handle_t *ctl_mux_output_handle_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Enumerate Display MUX Devices on this system across adapters -/// -/// @details -/// - The application enumerates all MUX devices in the system -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hAPIHandle` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pCount` -/// + `nullptr == phMuxDevices` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlEnumerateMuxDevices( - ctl_api_handle_t hAPIHandle, ///< [in][release] Applications should pass the Control API handle returned - ///< by the CtlInit function - uint32_t* pCount, ///< [in,out][release] pointer to the number of MUX device instances. If - ///< input count is zero, then the api will update the value with the total - ///< number of MUX devices available and return the Count value. If input - ///< count is non-zero, then the api will only retrieve the number of MUX Devices. - ///< If count is larger than the number of MUX devices available, then the - ///< api will update the value with the correct number of MUX devices available. - ctl_mux_output_handle_t* phMuxDevices ///< [out][range(0, *pCount)] array of MUX device instance handles - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Display MUX device properties -typedef struct _ctl_mux_properties_t -{ - uint32_t Size; ///< [in] size of this structure - uint8_t Version; ///< [in] version of this structure - uint8_t MuxId; ///< [out] MUX ID of this MUX device enumerated - uint32_t Count; ///< [in,out] Pointer to the number of display output instances this MUX - ///< object can drive. If count is zero, then the api will update the value - ///< with the total - ///< number of outputs available. If count is non-zero, then the api will - ///< only retrieve the number of outputs. - ///< If count is larger than the number of display outputs MUX can drive, - ///< then the api will update the value with the correct number of display - ///< outputs MUX can driver. - ctl_display_output_handle_t* phDisplayOutputs; ///< [in,out][range(0, *pCount)] Array of display output instance handles - ///< this MUX device can drive - uint8_t IndexOfDisplayOutputOwningMux; ///< [out] [range(0, (Count-1))] This is the index into the - ///< phDisplayOutputs list to the display output which currently owns the - ///< MUX output. This doesn't mean display is active - -} ctl_mux_properties_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Get Display Mux properties -/// -/// @details -/// - Get the propeties of the Mux device -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMuxDevice` -/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER -/// + `nullptr == pMuxProperties` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlGetMuxProperties( - ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle - ctl_mux_properties_t* pMuxProperties ///< [in,out] MUX device properties - ); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Switch Mux output -/// -/// @details -/// - Switches the MUX output -/// -/// @returns -/// - CTL_RESULT_SUCCESS -/// - CTL_RESULT_ERROR_UNINITIALIZED -/// - CTL_RESULT_ERROR_DEVICE_LOST -/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `nullptr == hMuxDevice` -/// + `nullptr == hInactiveDisplayOutput` -/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version" -CTL_APIEXPORT ctl_result_t CTL_APICALL -ctlSwitchMux( - ctl_mux_output_handle_t hMuxDevice, ///< [in] MUX device instance handle - ctl_display_output_handle_t hInactiveDisplayOutput ///< [out] Input selection for this MUX, which if active will drive the - ///< output of this MUX device. This should be one of the display output - ///< handles reported under this MUX device's properties. - ); - /////////////////////////////////////////////////////////////////////////////// /// @brief Intel Arc Sync profile typedef enum _ctl_intel_arc_sync_profile_t @@ -8360,31 +8260,6 @@ typedef ctl_result_t (CTL_APICALL *ctl_pfnGetIntelArcSyncInfoForMonitor_t)( ); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlEnumerateMuxDevices -typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumerateMuxDevices_t)( - ctl_api_handle_t, - uint32_t*, - ctl_mux_output_handle_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlGetMuxProperties -typedef ctl_result_t (CTL_APICALL *ctl_pfnGetMuxProperties_t)( - ctl_mux_output_handle_t, - ctl_mux_properties_t* - ); - - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for ctlSwitchMux -typedef ctl_result_t (CTL_APICALL *ctl_pfnSwitchMux_t)( - ctl_mux_output_handle_t, - ctl_display_output_handle_t - ); - - /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for ctlGetIntelArcSyncProfile typedef ctl_result_t (CTL_APICALL *ctl_pfnGetIntelArcSyncProfile_t)( From 95712583ab4e7e94d98354370b928192469b6e29 Mon Sep 17 00:00:00 2001 From: GfxDisplayBot Date: Mon, 16 Feb 2026 22:29:03 -0800 Subject: [PATCH 25/26] Updated version to v272 --- Samples/Color_Samples/Color_Sample_App.cpp | 20 ++++++------ .../PowerFeature_Sample_App.cpp | 32 ++++++++++++++++--- Samples/UBRR_Sample/UBRR_Sample_App.cpp | 7 ++-- Source/cApiWrapper.cpp | 5 ++- include/igcl_api.h | 5 ++- 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/Samples/Color_Samples/Color_Sample_App.cpp b/Samples/Color_Samples/Color_Sample_App.cpp index 3c8deb5..ab095a9 100644 --- a/Samples/Color_Samples/Color_Sample_App.cpp +++ b/Samples/Color_Samples/Color_Sample_App.cpp @@ -1951,8 +1951,9 @@ ctl_result_t TestLaceGetSetConfigForFixedAgressiveness(ctl_display_output_handle ctl_lace_config_t NewLaceConfigSettings = { 0 }; ctl_power_optimization_caps_t PowerCaps = { 0 }; - PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); - Result = ctlGetPowerOptimizationCaps(hDisplayOutput, &PowerCaps); + PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + PowerCaps.Version = 1; + Result = ctlGetPowerOptimizationCaps(hDisplayOutput, &PowerCaps); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationCaps (LACE)"); if (CTL_POWER_OPTIMIZATION_FLAG_LACE != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_LACE)) @@ -1962,7 +1963,7 @@ ctl_result_t TestLaceGetSetConfigForFixedAgressiveness(ctl_display_output_handle goto Exit; } - NewLaceConfigSettings.Version = 0; + NewLaceConfigSettings.Version = 1; NewLaceConfigSettings.Size = sizeof(ctl_lace_config_t); NewLaceConfigSettings.Enabled = TRUE; NewLaceConfigSettings.OpTypeSet = CTL_SET_OPERATION_CUSTOM; @@ -1974,7 +1975,7 @@ ctl_result_t TestLaceGetSetConfigForFixedAgressiveness(ctl_display_output_handle // Get Lace Config Call for current flag AppliedLaceConfigSettings = { 0 }; - AppliedLaceConfigSettings.Version = 0; + AppliedLaceConfigSettings.Version = 1; AppliedLaceConfigSettings.Size = sizeof(ctl_lace_config_t); AppliedLaceConfigSettings.OpTypeGet = CTL_GET_OPERATION_FLAG_CURRENT; @@ -1997,13 +1998,14 @@ ctl_result_t TestLaceGetSetConfigForALS(ctl_display_output_handle_t hDisplayOutp ctl_lace_config_t AppliedLaceConfigSettings = { 0 }; ctl_lace_config_t NewLaceConfigSettings = { 0 }; ctl_power_optimization_caps_t PowerCaps = { 0 }; - AppliedLaceConfigSettings.Version = 0; + AppliedLaceConfigSettings.Version = 1; AppliedLaceConfigSettings.Size = sizeof(ctl_lace_config_t); AppliedLaceConfigSettings.OpTypeGet = CTL_GET_OPERATION_FLAG_CAPABILITY; uint32_t MaxNumEntries = 0; - PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); - Result = ctlGetPowerOptimizationCaps(hDisplayOutput, &PowerCaps); + PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + PowerCaps.Version = 1; + Result = ctlGetPowerOptimizationCaps(hDisplayOutput, &PowerCaps); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationCaps (LACE)"); if (CTL_POWER_OPTIMIZATION_FLAG_LACE != (PowerCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_LACE)) @@ -2019,7 +2021,7 @@ ctl_result_t TestLaceGetSetConfigForALS(ctl_display_output_handle_t hDisplayOutp MaxNumEntries = AppliedLaceConfigSettings.LaceConfig.AggrLevelMap.MaxNumEntries; - NewLaceConfigSettings.Version = 0; + NewLaceConfigSettings.Version = 1; NewLaceConfigSettings.Size = sizeof(ctl_lace_config_t); NewLaceConfigSettings.Enabled = TRUE; NewLaceConfigSettings.OpTypeSet = CTL_SET_OPERATION_CUSTOM; @@ -2041,7 +2043,7 @@ ctl_result_t TestLaceGetSetConfigForALS(ctl_display_output_handle_t hDisplayOutp // Get Lace Config Call for current flag AppliedLaceConfigSettings = { 0 }; - AppliedLaceConfigSettings.Version = 0; + AppliedLaceConfigSettings.Version = 1; AppliedLaceConfigSettings.Size = sizeof(ctl_lace_config_t); AppliedLaceConfigSettings.OpTypeGet = CTL_GET_OPERATION_FLAG_CURRENT; AppliedLaceConfigSettings.LaceConfig.AggrLevelMap.NumEntries = MaxNumEntries; diff --git a/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp b/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp index d558ecc..8c0cf3d 100644 --- a/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp +++ b/Samples/Power_Feature_Samples/PowerFeature_Sample_App.cpp @@ -45,12 +45,15 @@ ctl_result_t TestPSRPowerFeature(ctl_display_output_handle_t hDisplayOutput) ctl_power_optimization_settings_t NewPowerSettings = { 0 }; PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + PowerCaps.Version = 1; AppliedPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + AppliedPowerSettings.Version = 1; AppliedPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_PSR; AppliedPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; AppliedPowerSettings.PowerOptimizationPlan = CTL_POWER_OPTIMIZATION_PLAN_BALANCED; NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + NewPowerSettings.Version = 1; NewPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_PSR; NewPowerSettings.Enable = TRUE; NewPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; @@ -96,7 +99,9 @@ ctl_result_t TestDPSTPowerFeature(ctl_display_output_handle_t hDisplayOutput) ctl_power_optimization_caps_t PowerCaps = { 0 }; PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + PowerCaps.Version = 1; AppliedPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + AppliedPowerSettings.Version = 1; AppliedPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; AppliedPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; AppliedPowerSettings.PowerOptimizationPlan = CTL_POWER_OPTIMIZATION_PLAN_BALANCED; @@ -133,6 +138,7 @@ ctl_result_t TestDPSTPowerFeature(ctl_display_output_handle_t hDisplayOutput) uint8_t Levels[2] = { AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel, AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel }; NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + NewPowerSettings.Version = 1; NewPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; NewPowerSettings.Enable = TRUE; NewPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_EPSM | CTL_POWER_OPTIMIZATION_DPST_FLAG_BKLT; // BKLT bit should be set to enable Intel DPST @@ -175,7 +181,9 @@ ctl_result_t TestOPSTPowerFeature(ctl_display_output_handle_t hDisplayOutput) ctl_power_optimization_caps_t PowerCaps = { 0 }; PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + PowerCaps.Version = 1; AppliedPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + AppliedPowerSettings.Version = 1; AppliedPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; AppliedPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; AppliedPowerSettings.PowerOptimizationPlan = CTL_POWER_OPTIMIZATION_PLAN_BALANCED; @@ -200,6 +208,7 @@ ctl_result_t TestOPSTPowerFeature(ctl_display_output_handle_t hDisplayOutput) APP_LOG_INFO("OPST MaxLevel = %d", AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel); NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + NewPowerSettings.Version = 1; NewPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; NewPowerSettings.Enable = TRUE; NewPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_OPST; @@ -244,7 +253,9 @@ ctl_result_t TestELPPowerFeature(ctl_display_output_handle_t hDisplayOutput) ctl_power_optimization_caps_t PowerCaps = { 0 }; PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + PowerCaps.Version = 1; AppliedPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + AppliedPowerSettings.Version = 1; AppliedPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; AppliedPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; AppliedPowerSettings.PowerOptimizationPlan = CTL_POWER_OPTIMIZATION_PLAN_BALANCED; @@ -269,6 +280,7 @@ ctl_result_t TestELPPowerFeature(ctl_display_output_handle_t hDisplayOutput) uint8_t Levels[2] = { AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel, AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel }; NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + NewPowerSettings.Version = 1; NewPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; NewPowerSettings.Enable = TRUE; NewPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_ELP; @@ -378,7 +390,9 @@ ctl_result_t TestApdPowerFeature(ctl_display_output_handle_t hDisplayOutput) ctl_power_optimization_caps_t PowerCaps = { 0 }; PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + PowerCaps.Version = 1; AppliedPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + AppliedPowerSettings.Version = 1; AppliedPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; AppliedPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; @@ -402,6 +416,7 @@ ctl_result_t TestApdPowerFeature(ctl_display_output_handle_t hDisplayOutput) uint8_t Levels[2] = { AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel, AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel }; NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + NewPowerSettings.Version = 1; NewPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; NewPowerSettings.Enable = TRUE; NewPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_APD; @@ -442,7 +457,9 @@ ctl_result_t TestPixOptixPowerFeature(ctl_display_output_handle_t hDisplayOutput ctl_power_optimization_caps_t PowerCaps = { 0 }; PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + PowerCaps.Version = 1; AppliedPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + AppliedPowerSettings.Version = 1; AppliedPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; AppliedPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; @@ -461,6 +478,7 @@ ctl_result_t TestPixOptixPowerFeature(ctl_display_output_handle_t hDisplayOutput } NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + NewPowerSettings.Version = 1; NewPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; NewPowerSettings.Enable = TRUE; NewPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_PIXOPTIX; @@ -497,8 +515,9 @@ ctl_result_t TestAlrrFeature(ctl_display_output_handle_t hDisplayOutput) ctl_power_optimization_caps_t PowerOptimizationCaps = { 0 }; ctl_power_optimization_settings_t PowerOptimizationSetting = { 0 }; - PowerOptimizationCaps.Size = sizeof(ctl_pfnGetPowerOptimizationCaps_t); - Result = ctlGetPowerOptimizationCaps(hDisplayOutput, &PowerOptimizationCaps); + PowerOptimizationCaps.Size = sizeof(ctl_pfnGetPowerOptimizationCaps_t); + PowerOptimizationCaps.Version = 1; + Result = ctlGetPowerOptimizationCaps(hDisplayOutput, &PowerOptimizationCaps); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationCaps (ALRR)"); @@ -536,8 +555,9 @@ ctl_result_t TestFbcPowerFeature(ctl_display_output_handle_t hDisplayOutput) ctl_power_optimization_caps_t PowerOptimizationCaps = { 0 }; ctl_power_optimization_settings_t PowerOptimizationSetting = { 0 }; - PowerOptimizationCaps.Size = sizeof(ctl_pfnGetPowerOptimizationCaps_t); - Result = ctlGetPowerOptimizationCaps(hDisplayOutput, &PowerOptimizationCaps); + PowerOptimizationCaps.Size = sizeof(ctl_pfnGetPowerOptimizationCaps_t); + PowerOptimizationCaps.Version = 1; + Result = ctlGetPowerOptimizationCaps(hDisplayOutput, &PowerOptimizationCaps); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationCaps (FBC)"); if (CTL_POWER_OPTIMIZATION_FLAG_FBC != (PowerOptimizationCaps.SupportedFeatures & CTL_POWER_OPTIMIZATION_FLAG_FBC)) @@ -555,6 +575,7 @@ ctl_result_t TestFbcPowerFeature(ctl_display_output_handle_t hDisplayOutput) { PowerOptimizationSetting.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_FBC; PowerOptimizationSetting.Size = sizeof(ctl_power_optimization_settings_t); + PowerOptimizationSetting.Version = 1; Result = ctlGetPowerOptimizationSetting(hDisplayOutput, &PowerOptimizationSetting); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationSetting"); @@ -579,7 +600,9 @@ ctl_result_t TestCABCPowerFeature(ctl_display_output_handle_t hDisplayOutput) ctl_power_optimization_caps_t PowerCaps = { 0 }; PowerCaps.Size = sizeof(ctl_power_optimization_caps_t); + PowerCaps.Version = 1; AppliedPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + AppliedPowerSettings.Version = 1; AppliedPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; AppliedPowerSettings.PowerSource = CTL_POWER_SOURCE_DC; AppliedPowerSettings.PowerOptimizationPlan = CTL_POWER_OPTIMIZATION_PLAN_BALANCED; @@ -604,6 +627,7 @@ ctl_result_t TestCABCPowerFeature(ctl_display_output_handle_t hDisplayOutput) uint8_t Levels[2] = { AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MinLevel, AppliedPowerSettings.FeatureSpecificData.DPSTInfo.MaxLevel }; NewPowerSettings.Size = sizeof(ctl_power_optimization_settings_t); + NewPowerSettings.Version = 1; NewPowerSettings.PowerOptimizationFeature = CTL_POWER_OPTIMIZATION_FLAG_DPST; NewPowerSettings.Enable = TRUE; NewPowerSettings.FeatureSpecificData.DPSTInfo.EnabledFeatures = CTL_POWER_OPTIMIZATION_DPST_FLAG_PANEL_CABC; diff --git a/Samples/UBRR_Sample/UBRR_Sample_App.cpp b/Samples/UBRR_Sample/UBRR_Sample_App.cpp index 7f44ae6..4ff25bb 100644 --- a/Samples/UBRR_Sample/UBRR_Sample_App.cpp +++ b/Samples/UBRR_Sample/UBRR_Sample_App.cpp @@ -56,8 +56,9 @@ ctl_result_t EnumerateDisplayHandles(ctl_display_output_handle_t *hDisplayOutput continue; } - PowerOptimizationCaps.Size = sizeof(ctl_pfnGetPowerOptimizationCaps_t); - Result = ctlGetPowerOptimizationCaps(hDisplayOutput[DisplayIndex], &PowerOptimizationCaps); + PowerOptimizationCaps.Size = sizeof(ctl_pfnGetPowerOptimizationCaps_t); + PowerOptimizationCaps.Version = 1; + Result = ctlGetPowerOptimizationCaps(hDisplayOutput[DisplayIndex], &PowerOptimizationCaps); LOG_AND_EXIT_ON_ERROR(Result, "ctlGetPowerOptimizationCaps"); @@ -219,4 +220,4 @@ int main() CTL_FREE_MEM(hDevices); APP_LOG_INFO("Overrall test result is 0x%X", GResult); return GResult; -} \ No newline at end of file +} diff --git a/Source/cApiWrapper.cpp b/Source/cApiWrapper.cpp index 492a583..1b67f19 100644 --- a/Source/cApiWrapper.cpp +++ b/Source/cApiWrapper.cpp @@ -2246,7 +2246,10 @@ ctlGetLinkedDisplayAdapters( * * @details * - To get the DCE feature status and, if feature is enabled, returns the -* current histogram, or to set the brightness at the phase-in speed +* current histogram, or to set the brightness at the phase-in speed. +* This is a reserved capability. By default, DCE is not supported/will +* not be enabled, need application to activate it, please contact Intel +* for activation. * * @returns * - CTL_RESULT_SUCCESS diff --git a/include/igcl_api.h b/include/igcl_api.h index f1fefb0..c40a0e9 100644 --- a/include/igcl_api.h +++ b/include/igcl_api.h @@ -4373,7 +4373,10 @@ typedef struct _ctl_dce_args_t /// /// @details /// - To get the DCE feature status and, if feature is enabled, returns the -/// current histogram, or to set the brightness at the phase-in speed +/// current histogram, or to set the brightness at the phase-in speed. +/// This is a reserved capability. By default, DCE is not supported/will +/// not be enabled, need application to activate it, please contact Intel +/// for activation. /// /// @returns /// - CTL_RESULT_SUCCESS From 269974ece60b68d2e5dff8a8881c1a1ab28550de Mon Sep 17 00:00:00 2001 From: Bassem Mohsen Date: Sun, 1 Mar 2026 15:57:58 +0100 Subject: [PATCH 26/26] Update to latest Intel source, Rename ToothNClaw Wrapper Signed-off-by: Bassem Mohsen --- Samples/ToothNClawWrapper/CMakeLists.txt | 20 + Samples/ToothNClawWrapper/CMakeSettings.json | 27 + Samples/ToothNClawWrapper/ColorAlgorithms.cpp | 229 ++ Samples/ToothNClawWrapper/ColorAlgorithms.h | 53 + .../ToothNClawWrapper/ColorAlgorithms_App.cpp | 213 ++ .../ToothNClawWrapper/ColorAlgorithms_App.h | 45 + Samples/ToothNClawWrapper/README.md | 7 + Samples/ToothNClawWrapper/Wrapper.cpp | 2352 +++++++++++++++++ 8 files changed, 2946 insertions(+) create mode 100644 Samples/ToothNClawWrapper/CMakeLists.txt create mode 100644 Samples/ToothNClawWrapper/CMakeSettings.json create mode 100644 Samples/ToothNClawWrapper/ColorAlgorithms.cpp create mode 100644 Samples/ToothNClawWrapper/ColorAlgorithms.h create mode 100644 Samples/ToothNClawWrapper/ColorAlgorithms_App.cpp create mode 100644 Samples/ToothNClawWrapper/ColorAlgorithms_App.h create mode 100644 Samples/ToothNClawWrapper/README.md create mode 100644 Samples/ToothNClawWrapper/Wrapper.cpp diff --git a/Samples/ToothNClawWrapper/CMakeLists.txt b/Samples/ToothNClawWrapper/CMakeLists.txt new file mode 100644 index 0000000..7384b98 --- /dev/null +++ b/Samples/ToothNClawWrapper/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.9) + +get_filename_component(ROOT_DIR ../../ ABSOLUTE) +set(project "IGCL_Wrapper") + +set(all_file + "Wrapper.cpp" + "ColorAlgorithms_App.cpp" + ${ROOT_DIR}/Source/cApiWrapper.cpp +) + +set(BUILD_SHARED_LIBS true) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS true) + +include_directories(${ROOT_DIR}/include) +include_directories(${ROOT_DIR}/Samples/inc) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +add_library(${project} ${all_file}) \ No newline at end of file diff --git a/Samples/ToothNClawWrapper/CMakeSettings.json b/Samples/ToothNClawWrapper/CMakeSettings.json new file mode 100644 index 0000000..0c5fbf9 --- /dev/null +++ b/Samples/ToothNClawWrapper/CMakeSettings.json @@ -0,0 +1,27 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "" + }, + { + "name": "x64-Release", + "generator": "Ninja", + "configurationType": "RelWithDebInfo", + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ], + "variables": [] + } + ] +} \ No newline at end of file diff --git a/Samples/ToothNClawWrapper/ColorAlgorithms.cpp b/Samples/ToothNClawWrapper/ColorAlgorithms.cpp new file mode 100644 index 0000000..b3daac2 --- /dev/null +++ b/Samples/ToothNClawWrapper/ColorAlgorithms.cpp @@ -0,0 +1,229 @@ +//=========================================================================== +// +// Copyright (c) Intel Corporation (2021-2022) +// +// INTEL MAKES NO WARRANTY OF ANY KIND REGARDING THE CODE. THIS CODE IS LICENSED +// ON AN "AS IS" BASIS AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, +// INSTALLATION, TRAINING OR OTHER SERVICES. INTEL DOES NOT PROVIDE ANY UPDATES, +// ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY WARRANTY OF +// MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR ANY PARTICULAR PURPOSE, OR ANY +// OTHER WARRANTY. Intel disclaims all liability, including liability for +// infringement of any proprietary rights, relating to use of the code. No license, +// express or implied, by estoppel or otherwise, to any intellectual property +// rights is granted herein. +// +//-------------------------------------------------------------------------- + +/** + * + * @file ColorAlgorithms.cpp + * @brief This file contains the algorithms for Color Sample APP. + * + */ + +#include "ColorAlgorithms.h" + +/*************************************************************** + * @brief + * MatrixMult3x3With3x1 + * @param Matrix1, Matrix2, Result + * @return void + ***************************************************************/ +void MatrixMult3x3With3x1(const double Matrix1[3][3], const double Matrix2[3], double Result[3]) +{ + double Tmp[3]; + + Tmp[0] = Matrix1[0][0] * Matrix2[0] + Matrix1[0][1] * Matrix2[1] + Matrix1[0][2] * Matrix2[2]; + Tmp[1] = Matrix1[1][0] * Matrix2[0] + Matrix1[1][1] * Matrix2[1] + Matrix1[1][2] * Matrix2[2]; + Tmp[2] = Matrix1[2][0] * Matrix2[0] + Matrix1[2][1] * Matrix2[1] + Matrix1[2][2] * Matrix2[2]; + + Result[0] = Tmp[0]; + Result[1] = Tmp[1]; + Result[2] = Tmp[2]; +} + +/*************************************************************** + * @brief + * MatrixMult3x3 + * @param Matrix1[3][3], Matrix2[3][3], Result[3][3] + * @return void + ***************************************************************/ +void MatrixMult3x3(const double Matrix1[3][3], const double Matrix2[3][3], double Result[3][3]) +{ + double Tmp[3][3]; + + for (int y = 0; y < 3; y++) + { + for (int x = 0; x < 3; x++) + { + Tmp[y][x] = Matrix1[y][0] * Matrix2[0][x] + Matrix1[y][1] * Matrix2[1][x] + Matrix1[y][2] * Matrix2[2][x]; + } + } + + memcpy_s(Result, sizeof(Tmp), Tmp, sizeof(Tmp)); +} + +/*************************************************************** + * @brief + * MatrixDeterminant3x3 + * @param Matrix[3][3] + * @return void + ***************************************************************/ +double MatrixDeterminant3x3(const double Matrix[3][3]) +{ + double Result; + + Result = Matrix[0][0] * (Matrix[1][1] * Matrix[2][2] - Matrix[1][2] * Matrix[2][1]); + Result -= Matrix[0][1] * (Matrix[1][0] * Matrix[2][2] - Matrix[1][2] * Matrix[2][0]); + Result += Matrix[0][2] * (Matrix[1][0] * Matrix[2][1] - Matrix[1][1] * Matrix[2][0]); + + return Result; +} + +/*************************************************************** + * @brief + * MatrixInverse3x3 + * @param Matrix[3][3], Result[3][3] + * @return void + ***************************************************************/ +void MatrixInverse3x3(const double Matrix[3][3], double Result[3][3]) +{ + double Tmp[3][3]; + double Determinant = MatrixDeterminant3x3(Matrix); + + if (0 != Determinant) + { + Tmp[0][0] = (Matrix[1][1] * Matrix[2][2] - Matrix[1][2] * Matrix[2][1]) / Determinant; + Tmp[0][1] = (Matrix[0][2] * Matrix[2][1] - Matrix[2][2] * Matrix[0][1]) / Determinant; + Tmp[0][2] = (Matrix[0][1] * Matrix[1][2] - Matrix[0][2] * Matrix[1][1]) / Determinant; + Tmp[1][0] = (Matrix[1][2] * Matrix[2][0] - Matrix[1][0] * Matrix[2][2]) / Determinant; + Tmp[1][1] = (Matrix[0][0] * Matrix[2][2] - Matrix[0][2] * Matrix[2][0]) / Determinant; + Tmp[1][2] = (Matrix[0][2] * Matrix[1][0] - Matrix[0][0] * Matrix[1][2]) / Determinant; + Tmp[2][0] = (Matrix[1][0] * Matrix[2][1] - Matrix[1][1] * Matrix[2][0]) / Determinant; + Tmp[2][1] = (Matrix[0][1] * Matrix[2][0] - Matrix[0][0] * Matrix[2][1]) / Determinant; + Tmp[2][2] = (Matrix[0][0] * Matrix[1][1] - Matrix[0][1] * Matrix[1][0]) / Determinant; + + Result[0][0] = Tmp[0][0]; + Result[0][1] = Tmp[0][1]; + Result[0][2] = Tmp[0][2]; + Result[1][0] = Tmp[1][0]; + Result[1][1] = Tmp[1][1]; + Result[1][2] = Tmp[1][2]; + Result[2][0] = Tmp[2][0]; + Result[2][1] = Tmp[2][1]; + Result[2][2] = Tmp[2][2]; + } +} + +/*************************************************************** + * @brief + * MatrixMultScalar3x3 + * @param Matrix[3][3], double + * @return void + ***************************************************************/ +void MatrixMultScalar3x3(double Matrix[3][3], double Multiplier) +{ + for (int y = 0; y < 3; y++) + { + for (int x = 0; x < 3; x++) + { + Matrix[y][x] *= Multiplier; + } + } +} + +/*************************************************************** + * @brief + * MatrixMaxSumOfRow3x3 + * @param Matrix[3][3] + * @return void + ***************************************************************/ +double MatrixMaxSumOfRow3x3(const double Matrix[3][3]) +{ + double Val, MaxVal = -10.0; + + for (int y = 0; y < 3; y++) + { + Val = Matrix[y][0] + Matrix[y][1] + Matrix[y][2]; + MaxVal = max(Val, MaxVal); + } + + return MaxVal; +} + +/*************************************************************** + * @brief + * MatrixNormalize3x3 + * @param Mat[3][3] + * @return void + ***************************************************************/ +void MatrixNormalize3x3(double Mat[3][3]) +{ + double Val = 0; + double Maxrow = MatrixMaxSumOfRow3x3(Mat); + + if (Maxrow > 1) + { + MatrixMultScalar3x3(Mat, (1.0 / Maxrow)); + } +} + +/*************************************************************** + * @brief + * CreateRGB2XYZMatrix + * @param ColorSpace, RGB2XYZ[3][3] + * return void + ***************************************************************/ +void CreateRGB2XYZMatrix(ColorSpace Cspace, double RGB2XYZ[3][3]) +{ + double XYZsum[3]; + double Z[4]; + double XYZw[3]; + + Z[0] = 1 - Cspace.White.CIEx - Cspace.White.CIEy; + Z[1] = 1 - Cspace.Red.CIEx - Cspace.Red.CIEy; + Z[2] = 1 - Cspace.Green.CIEx - Cspace.Green.CIEy; + Z[3] = 1 - Cspace.Blue.CIEx - Cspace.Blue.CIEy; + + XYZw[0] = Cspace.White.CIEx / Cspace.White.CIEy; + XYZw[1] = 1; + XYZw[2] = Z[0] / Cspace.White.CIEy; + + double XYZRGB[3][3] = { { Cspace.Red.CIEx, Cspace.Green.CIEx, Cspace.Blue.CIEx }, { Cspace.Red.CIEy, Cspace.Green.CIEy, Cspace.Blue.CIEy }, { Z[1], Z[2], Z[3] } }; + double Mat1[3][3]; + + MatrixInverse3x3(XYZRGB, Mat1); + MatrixMult3x3With3x1(Mat1, XYZw, XYZsum); + + double Mat2[3][3] = { { XYZsum[0], 0, 0 }, { 0, XYZsum[1], 0 }, { 0, 0, XYZsum[2] } }; + + MatrixMult3x3(XYZRGB, Mat2, RGB2XYZ); +} + +/*************************************************************** + * @brief + * CreateMatrixForMappingPanelToSRGBColorSpace + * This funtion is called with PanelColorSpace which maps it with the SRGB color space + * @param ColorSpace, GeneratedOutputMatrix[3][3] + * @return void + ***************************************************************/ +void CreateMatrixForMappingPanelToSRGBColorSpace(ColorSpace PanelColorSpace, double GeneratedOutputMatrix[3][3]) +{ + // standard SRGB color space harcoded https://en.wikipedia.org/wiki/SRGB + static ColorSpace SRGBColorSpace = { + { 0.3127, 0.3290, 1.0 }, // white x,y,Y + { 0.64, 0.33, 0.2126 }, // red + { 0.30, 0.60, 0.7152 }, // green + { 0.15, 0.060, 0.0722 } // blue + }; + double RGB2XYZ_Target[3][3]; + double RGB2XYZ_Panel[3][3]; + double XYZ2RGB_Panel[3][3]; + + CreateRGB2XYZMatrix(SRGBColorSpace, RGB2XYZ_Target); // convert SRGB to XYZ + + CreateRGB2XYZMatrix(PanelColorSpace, RGB2XYZ_Panel); // convert Panel to XYZ + MatrixInverse3x3(RGB2XYZ_Panel, XYZ2RGB_Panel); + MatrixMult3x3(XYZ2RGB_Panel, RGB2XYZ_Target, GeneratedOutputMatrix); + MatrixNormalize3x3(GeneratedOutputMatrix); +} \ No newline at end of file diff --git a/Samples/ToothNClawWrapper/ColorAlgorithms.h b/Samples/ToothNClawWrapper/ColorAlgorithms.h new file mode 100644 index 0000000..3471c26 --- /dev/null +++ b/Samples/ToothNClawWrapper/ColorAlgorithms.h @@ -0,0 +1,53 @@ +//=========================================================================== +// +// Copyright (c) Intel Corporation (2021-2022) +// +// INTEL MAKES NO WARRANTY OF ANY KIND REGARDING THE CODE. THIS CODE IS LICENSED +// ON AN "AS IS" BASIS AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, +// INSTALLATION, TRAINING OR OTHER SERVICES. INTEL DOES NOT PROVIDE ANY UPDATES, +// ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY WARRANTY OF +// MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR ANY PARTICULAR PURPOSE, OR ANY +// OTHER WARRANTY. Intel disclaims all liability, including liability for +// infringement of any proprietary rights, relating to use of the code. No license, +// express or implied, by estoppel or otherwise, to any intellectual property +// rights is granted herein. +// +//-------------------------------------------------------------------------- + +/** + * + * @file ColorAlgorithms.h + * @brief + * + */ + +#pragma once + +#include +#include + +// https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space +typedef struct +{ + double CIEx; + double CIEy; + double CIELuminance; +} IPIXEL_xyY; + +typedef struct ColorSpace +{ + IPIXEL_xyY White; + IPIXEL_xyY Red; + IPIXEL_xyY Green; + IPIXEL_xyY Blue; +} ColorSpace; + +void MatrixMult3x3With3x1(const double Matrix1[3][3], const double Matrix2[3], double Result[3]); +void MatrixMult3x3(const double Matrix1[3][3], const double Matrix2[3][3], double Result[3][3]); +double MatrixDeterminant3x3(const double Matrix[3][3]); +void MatrixInverse3x3(const double Matrix[3][3], double Result[3][3]); +void MatrixMultScalar3x3(double Matrix[3][3], double Multiplier); +double MatrixMaxSumOfRow3x3(const double Matrix[3][3]); +void MatrixNormalize3x3(double Mat[3][3]); +void CreateRGB2XYZMatrix(ColorSpace Cspace, double RGB2XYZ[3][3]); +void CreateMatrixForMappingPanelToSRGBColorSpace(ColorSpace PanelColorSpace, double GeneratedOutputMatrix[3][3]); diff --git a/Samples/ToothNClawWrapper/ColorAlgorithms_App.cpp b/Samples/ToothNClawWrapper/ColorAlgorithms_App.cpp new file mode 100644 index 0000000..e390295 --- /dev/null +++ b/Samples/ToothNClawWrapper/ColorAlgorithms_App.cpp @@ -0,0 +1,213 @@ +//=========================================================================== +// Copyright (C) 2022 Intel Corporation +// +// +// +// SPDX-License-Identifier: MIT +//-------------------------------------------------------------------------- + +/** + * + * @file ColorAlgorithms_App.cpp + * @brief This file contains the algorithms for Color Sample APP. + * + */ + +#include "ColorAlgorithms_App.h" + +/*************************************************************** + * @brief + * MatrixMult3x3With3x1 + * @param Matrix1, Matrix2, Result + * @return void + ***************************************************************/ +void MatrixMult3x3With3x1(const double Matrix1[3][3], const double Matrix2[3], double Result[3]) +{ + double Tmp[3]; + + Tmp[0] = Matrix1[0][0] * Matrix2[0] + Matrix1[0][1] * Matrix2[1] + Matrix1[0][2] * Matrix2[2]; + Tmp[1] = Matrix1[1][0] * Matrix2[0] + Matrix1[1][1] * Matrix2[1] + Matrix1[1][2] * Matrix2[2]; + Tmp[2] = Matrix1[2][0] * Matrix2[0] + Matrix1[2][1] * Matrix2[1] + Matrix1[2][2] * Matrix2[2]; + + Result[0] = Tmp[0]; + Result[1] = Tmp[1]; + Result[2] = Tmp[2]; +} + +/*************************************************************** + * @brief + * MatrixMult3x3 + * @param Matrix1[3][3], Matrix2[3][3], Result[3][3] + * @return void + ***************************************************************/ +void MatrixMult3x3(const double Matrix1[3][3], const double Matrix2[3][3], double Result[3][3]) +{ + double Tmp[3][3]; + + for (int y = 0; y < 3; y++) + { + for (int x = 0; x < 3; x++) + { + Tmp[y][x] = Matrix1[y][0] * Matrix2[0][x] + Matrix1[y][1] * Matrix2[1][x] + Matrix1[y][2] * Matrix2[2][x]; + } + } + + memcpy_s(Result, sizeof(Tmp), Tmp, sizeof(Tmp)); +} + +/*************************************************************** + * @brief + * MatrixDeterminant3x3 + * @param Matrix[3][3] + * @return void + ***************************************************************/ +double MatrixDeterminant3x3(const double Matrix[3][3]) +{ + double Result; + + Result = Matrix[0][0] * (Matrix[1][1] * Matrix[2][2] - Matrix[1][2] * Matrix[2][1]); + Result -= Matrix[0][1] * (Matrix[1][0] * Matrix[2][2] - Matrix[1][2] * Matrix[2][0]); + Result += Matrix[0][2] * (Matrix[1][0] * Matrix[2][1] - Matrix[1][1] * Matrix[2][0]); + + return Result; +} + +/*************************************************************** + * @brief + * MatrixInverse3x3 + * @param Matrix[3][3], Result[3][3] + * @return void + ***************************************************************/ +void MatrixInverse3x3(const double Matrix[3][3], double Result[3][3]) +{ + double Tmp[3][3]; + double Determinant = MatrixDeterminant3x3(Matrix); + + if (0 != Determinant) + { + Tmp[0][0] = (Matrix[1][1] * Matrix[2][2] - Matrix[1][2] * Matrix[2][1]) / Determinant; + Tmp[0][1] = (Matrix[0][2] * Matrix[2][1] - Matrix[2][2] * Matrix[0][1]) / Determinant; + Tmp[0][2] = (Matrix[0][1] * Matrix[1][2] - Matrix[0][2] * Matrix[1][1]) / Determinant; + Tmp[1][0] = (Matrix[1][2] * Matrix[2][0] - Matrix[1][0] * Matrix[2][2]) / Determinant; + Tmp[1][1] = (Matrix[0][0] * Matrix[2][2] - Matrix[0][2] * Matrix[2][0]) / Determinant; + Tmp[1][2] = (Matrix[0][2] * Matrix[1][0] - Matrix[0][0] * Matrix[1][2]) / Determinant; + Tmp[2][0] = (Matrix[1][0] * Matrix[2][1] - Matrix[1][1] * Matrix[2][0]) / Determinant; + Tmp[2][1] = (Matrix[0][1] * Matrix[2][0] - Matrix[0][0] * Matrix[2][1]) / Determinant; + Tmp[2][2] = (Matrix[0][0] * Matrix[1][1] - Matrix[0][1] * Matrix[1][0]) / Determinant; + + Result[0][0] = Tmp[0][0]; + Result[0][1] = Tmp[0][1]; + Result[0][2] = Tmp[0][2]; + Result[1][0] = Tmp[1][0]; + Result[1][1] = Tmp[1][1]; + Result[1][2] = Tmp[1][2]; + Result[2][0] = Tmp[2][0]; + Result[2][1] = Tmp[2][1]; + Result[2][2] = Tmp[2][2]; + } +} + +/*************************************************************** + * @brief + * MatrixMultScalar3x3 + * @param Matrix[3][3], double + * @return void + ***************************************************************/ +void MatrixMultScalar3x3(double Matrix[3][3], double Multiplier) +{ + for (int y = 0; y < 3; y++) + { + for (int x = 0; x < 3; x++) + { + Matrix[y][x] *= Multiplier; + } + } +} + +/*************************************************************** + * @brief + * MatrixMaxSumOfRow3x3 + * @param Matrix[3][3] + * @return void + ***************************************************************/ +double MatrixMaxSumOfRow3x3(const double Matrix[3][3]) +{ + double Val, MaxVal = -10.0; + + for (int y = 0; y < 3; y++) + { + Val = Matrix[y][0] + Matrix[y][1] + Matrix[y][2]; + MaxVal = max(Val, MaxVal); + } + + return MaxVal; +} + +/*************************************************************** + * @brief + * MatrixNormalize3x3 + * @param Mat[3][3] + * @return void + ***************************************************************/ +void MatrixNormalize3x3(double Mat[3][3]) +{ + double Val = 0; + double Maxrow = MatrixMaxSumOfRow3x3(Mat); + + if (Maxrow > 1) + { + MatrixMultScalar3x3(Mat, (1.0 / Maxrow)); + } +} + +/*************************************************************** + * @brief + * CreateRGB2XYZMatrix + * @param ColorSpace, RGB2XYZ[3][3] + * return void + ***************************************************************/ +void CreateRGB2XYZMatrix(ColorSpace Cspace, double RGB2XYZ[3][3]) +{ + double XYZsum[3]; + double Z[4]; + double XYZw[3]; + + Z[0] = 1 - Cspace.White.CIEx - Cspace.White.CIEy; + Z[1] = 1 - Cspace.Red.CIEx - Cspace.Red.CIEy; + Z[2] = 1 - Cspace.Green.CIEx - Cspace.Green.CIEy; + Z[3] = 1 - Cspace.Blue.CIEx - Cspace.Blue.CIEy; + + XYZw[0] = Cspace.White.CIEx / Cspace.White.CIEy; + XYZw[1] = 1; + XYZw[2] = Z[0] / Cspace.White.CIEy; + + double XYZRGB[3][3] = { { Cspace.Red.CIEx, Cspace.Green.CIEx, Cspace.Blue.CIEx }, { Cspace.Red.CIEy, Cspace.Green.CIEy, Cspace.Blue.CIEy }, { Z[1], Z[2], Z[3] } }; + double Mat1[3][3]; + + MatrixInverse3x3(XYZRGB, Mat1); + MatrixMult3x3With3x1(Mat1, XYZw, XYZsum); + + double Mat2[3][3] = { { XYZsum[0], 0, 0 }, { 0, XYZsum[1], 0 }, { 0, 0, XYZsum[2] } }; + + MatrixMult3x3(XYZRGB, Mat2, RGB2XYZ); +} + +/*************************************************************** + * @brief + * CreateMatrixToScaleAndRotatePanelToContentColorSpace + * This funtion is called with PanelColorSpace which maps it with the Content color space + * @param ColorSpace,ContentColorSpace, GeneratedOutputMatrix[3][3] + * @return void + ***************************************************************/ +void CreateMatrixToScaleAndRotatePanelToContentColorSpace(ColorSpace PanelColorSpace, ColorSpace ContentColorSpace, double GeneratedOutputMatrix[3][3]) +{ + double RGB2XYZ_Content[3][3]; + double RGB2XYZ_Panel[3][3]; + double XYZ2RGB_Panel[3][3]; + + CreateRGB2XYZMatrix(ContentColorSpace, RGB2XYZ_Content); // convert ContentColorSpace to XYZ + CreateRGB2XYZMatrix(PanelColorSpace, RGB2XYZ_Panel); // convert Panel to XYZ + MatrixInverse3x3(RGB2XYZ_Panel, XYZ2RGB_Panel); + MatrixMult3x3(XYZ2RGB_Panel, RGB2XYZ_Content, GeneratedOutputMatrix); + MatrixNormalize3x3(GeneratedOutputMatrix); +} \ No newline at end of file diff --git a/Samples/ToothNClawWrapper/ColorAlgorithms_App.h b/Samples/ToothNClawWrapper/ColorAlgorithms_App.h new file mode 100644 index 0000000..110f75b --- /dev/null +++ b/Samples/ToothNClawWrapper/ColorAlgorithms_App.h @@ -0,0 +1,45 @@ +//=========================================================================== +// Copyright (C) 2022 Intel Corporation +// +// +// +// SPDX-License-Identifier: MIT +//-------------------------------------------------------------------------- + +/** + * + * @file ColorAlgorithms_App.h + * @brief + * + */ + +#pragma once + +#include +#include + +// https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_xy_chromaticity_diagram_and_the_CIE_xyY_color_space +typedef struct +{ + double CIEx; + double CIEy; + double CIELuminance; +} IPIXEL_xyY; + +typedef struct ColorSpace +{ + IPIXEL_xyY White; + IPIXEL_xyY Red; + IPIXEL_xyY Green; + IPIXEL_xyY Blue; +} ColorSpace; + +void MatrixMult3x3With3x1(const double Matrix1[3][3], const double Matrix2[3], double Result[3]); +void MatrixMult3x3(const double Matrix1[3][3], const double Matrix2[3][3], double Result[3][3]); +double MatrixDeterminant3x3(const double Matrix[3][3]); +void MatrixInverse3x3(const double Matrix[3][3], double Result[3][3]); +void MatrixMultScalar3x3(double Matrix[3][3], double Multiplier); +double MatrixMaxSumOfRow3x3(const double Matrix[3][3]); +void MatrixNormalize3x3(double Mat[3][3]); +void CreateRGB2XYZMatrix(ColorSpace Cspace, double RGB2XYZ[3][3]); +void CreateMatrixToScaleAndRotatePanelToContentColorSpace(ColorSpace PanelColorSpace, ColorSpace ContentColorSpace, double GeneratedOutputMatrix[3][3]); diff --git a/Samples/ToothNClawWrapper/README.md b/Samples/ToothNClawWrapper/README.md new file mode 100644 index 0000000..0cbceb8 --- /dev/null +++ b/Samples/ToothNClawWrapper/README.md @@ -0,0 +1,7 @@ +Tooth N Claw IGCL Wrapper + +# How to build +- Load the CMakeLists.txt in Visual Studio community edition +- Build as Release x64 +- Copy Samples\ToothNClawWrapper\out\build\x64-Release\IGCL_Wrapper.dll to the ToothNClaw projet in the following path +ToothNClaw\Tooth.Backend\Libraries \ No newline at end of file diff --git a/Samples/ToothNClawWrapper/Wrapper.cpp b/Samples/ToothNClawWrapper/Wrapper.cpp new file mode 100644 index 0000000..fa5d0c3 --- /dev/null +++ b/Samples/ToothNClawWrapper/Wrapper.cpp @@ -0,0 +1,2352 @@ +//=========================================================================== +// Copyright (C) 2022 Intel Corporation +// +// +// +// SPDX-License-Identifier: MIT +//-------------------------------------------------------------------------- + +/** + * + * @file Wrapper.cpp + * @brief This file contains the 'main' function. Program execution begins and ends there. + * + */ + +#define _CRTDBG_MAP_ALLOC +#include +#include +#include +#include +#include +using namespace std; + +#define CTL_APIEXPORT // caller of control API DLL shall define this before + // including igcl_api.h +#include "igcl_api.h" +#include "GenericIGCLApp.h" +#include "ColorAlgorithms_App.h" +#include "GenericIGCLApp.h" + + +/* -------------- Definitions and variables from Color_Sample_App.cpp ------------------*/ +ctl_result_t GResult = CTL_RESULT_SUCCESS; + +#define SATURATION_FACTOR_BASE 1.0 +#define DEFAULT_COLOR_SAT SATURATION_FACTOR_BASE +#define MIN_COLOR_SAT (SATURATION_FACTOR_BASE - 0.25) +#define MAX_COLOR_SAT (SATURATION_FACTOR_BASE + 0.25) +#define UV_MAX_POINT 0.4375 +#define UV_MIN_POINT1 0.0029297 +#define UV_MIN_POINT2 0.01074 +#define UV_MAX_VAL 255.0 +#define CLIP_DOUBLE(Val, Min, Max) (((Val) < (Min)) ? (Min) : (((Val) > (Max)) ? (Max) : (Val))) +#define ABS_DOUBLE(x) ((x) < 0 ? (-x) : (x)) +#define DEFAULT_GAMMA_VALUE 2.2 + +// Convert RGB to YUV +const double RGB2YCbCr709[3][3] = { { 0.2126, 0.7152, 0.0722 }, { -0.1146, -0.3854, 0.5000 }, { 0.5000, -0.4542, -0.0458 } }; + +// Convert YUV to RGB +const double YCbCr2RGB709[3][3] = { { 1.0000, 0.0000, 1.5748 }, { 1.0000, -0.1873, -0.4681 }, { 1.0000, 1.8556, 0.0000 } }; + +// convert RGB to XYZ +const double RGB2XYZ_709[3][3] = { { 0.41239080, 0.35758434, 0.18048079 }, { 0.21263901, 0.71516868, 0.07219232 }, { 0.01933082, 0.11919478, 0.95053215 } }; + +const double Pi = 3.1415926535897932; +const double Beta = 0.018053968510807; +const double Alpha = 1.09929682680944; + +typedef struct +{ + double R; + double G; + double B; +} IPIXELD; + +typedef struct +{ + double Y; + double Cb; + double Cr; +} IPIXELD_YCbCr; + +typedef enum HUE_ANCHOR +{ + HUE_ANCHOR_RED_SATURATION = 0, + HUE_ANCHOR_YELLOW_SATURATION = 1, + HUE_ANCHOR_GREEN_SATURATION = 2, + HUE_ANCHOR_CYAN_SATURATION = 3, + HUE_ANCHOR_BLUE_SATURATION = 4, + HUE_ANCHOR_MAGENTA_SATURATION = 5, + HUE_ANCHOR_COLOR_COUNT_SATURATION = 6 +} HUE_ANCHOR; + +typedef enum +{ + GAMMA_ENCODING_TYPE_SRGB = 0, // Gamma encoding SRGB + GAMMA_ENCODING_TYPE_REC709 = 1, // Gamma encoding REC709 + GAMMA_ENCODING_TYPE_REC2020 = 2, // Gamma encoding REC2020 +} GAMMA_ENCODING_TYPE; + +// https://en.wikipedia.org/wiki/CIE_1931_color_space +typedef struct +{ + double X; + double Y; + double Z; +} IPIXEL_XYZ; + +// https://en.wikipedia.org/wiki/CIELAB_color_space +typedef struct +{ + double L; + double A; + double B; +} IPIXEL_Lab; + +typedef struct +{ + double RedSat; + double YellowSat; + double GreenSat; + double CyanSat; + double BlueSat; + double MagentaSat; +} PARTIAL_SATURATION_WEIGHTS; + +const IPIXEL_XYZ RefWhitePointSRGB = { 95.0489, 100.0, 108.8840 }; + + +/* -------------------------------------------------------------- */ + +typedef struct ctl_telemetry_data +{ + // GPU TDP + bool gpuEnergySupported = false; + double gpuEnergyValue; + + // GPU Voltage + bool gpuVoltageSupported = false; + double gpuVoltagValue; + + // GPU Core Frequency + bool gpuCurrentClockFrequencySupported = false; + double gpuCurrentClockFrequencyValue; + + // GPU Core Temperature + bool gpuCurrentTemperatureSupported = false; + double gpuCurrentTemperatureValue; + + // GPU Usage + bool globalActivitySupported = false; + double globalActivityValue; + + // Render Engine Usage + bool renderComputeActivitySupported = false; + double renderComputeActivityValue; + + // Media Engine Usage + bool mediaActivitySupported = false; + double mediaActivityValue; + + // VRAM Power Consumption + bool vramEnergySupported = false; + double vramEnergyValue; + + // VRAM Voltage + bool vramVoltageSupported = false; + double vramVoltageValue; + + // VRAM Frequency + bool vramCurrentClockFrequencySupported = false; + double vramCurrentClockFrequencyValue; + + // VRAM Read Bandwidth + bool vramReadBandwidthSupported = false; + double vramReadBandwidthValue; + + // VRAM Write Bandwidth + bool vramWriteBandwidthSupported = false; + double vramWriteBandwidthValue; + + // VRAM Temperature + bool vramCurrentTemperatureSupported = false; + double vramCurrentTemperatureValue; + + // Fanspeed (n Fans) + bool fanSpeedSupported = false; + double fanSpeedValue; +}; + +typedef struct ctl_fps_limiter_t +{ + bool isLimiterEnabled = false; + int32_t fpsLimitValue = 30; +}; + +ctl_api_handle_t hAPIHandle; +ctl_device_adapter_handle_t* hDevices; + +extern "C" { + + double deltatimestamp = 0; + double prevtimestamp = 0; + double curtimestamp = 0; + double prevgpuEnergyCounter = 0; + double curgpuEnergyCounter = 0; + double curglobalActivityCounter = 0; + double prevglobalActivityCounter = 0; + double currenderComputeActivityCounter = 0; + double prevrenderComputeActivityCounter = 0; + double curmediaActivityCounter = 0; + double prevmediaActivityCounter = 0; + double curvramEnergyCounter = 0; + double prevvramEnergyCounter = 0; + double curvramReadBandwidthCounter = 0; + double prevvramReadBandwidthCounter = 0; + double curvramWriteBandwidthCounter = 0; + double prevvramWriteBandwidthCounter = 0; + + ctl_result_t GetRetroScalingCaps(ctl_device_adapter_handle_t hDevice, ctl_retro_scaling_caps_t* RetroScalingCaps) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + RetroScalingCaps->Size = sizeof(ctl_retro_scaling_caps_t); + + Result = ctlGetSupportedRetroScalingCapability(hDevice, RetroScalingCaps); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSupportedRetroScalingCapability"); + + cout << "======== GetRetroScalingCaps ========" << endl; + cout << "RetroScalingCaps.SupportedRetroScaling: " << RetroScalingCaps->SupportedRetroScaling << endl; + + Exit: + return Result; + } + + ctl_result_t GetRetroScalingSettings(ctl_device_adapter_handle_t hDevice, ctl_retro_scaling_settings_t* RetroScalingSettings) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + RetroScalingSettings->Get = TRUE; + RetroScalingSettings->Size = sizeof(ctl_retro_scaling_settings_t); + + Result = ctlGetSetRetroScaling(hDevice, RetroScalingSettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetRetroScaling"); + + cout << "======== GetRetroScalingSettings ========" << endl; + cout << "RetroScalingSettings.Get: " << RetroScalingSettings->Get << endl; + cout << "RetroScalingSettings.Enable: " << RetroScalingSettings->Enable << endl; + cout << "RetroScalingSettings.RetroScalingType: " << RetroScalingSettings->RetroScalingType << endl; + + Exit: + return Result; + } + + ctl_result_t SetRetroScalingSettings(ctl_device_adapter_handle_t hDevice, ctl_retro_scaling_settings_t RetroScalingSettings) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + RetroScalingSettings.Get = FALSE; + RetroScalingSettings.Size = sizeof(ctl_retro_scaling_settings_t); + + Result = ctlGetSetRetroScaling(hDevice, &RetroScalingSettings); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSetRetroScaling"); + + cout << "======== SetRetroScalingSettings ========" << endl; + cout << "RetroScalingSettings.Get: " << RetroScalingSettings.Get << endl; + cout << "RetroScalingSettings.Enable: " << RetroScalingSettings.Enable << endl; + cout << "RetroScalingSettings.RetroScalingType: " << RetroScalingSettings.RetroScalingType << endl; + + Exit: + return Result; + } + + ctl_result_t GetScalingCaps(ctl_device_adapter_handle_t hDevice, uint32_t idx, ctl_scaling_caps_t* ScalingCaps) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + ctl_display_output_handle_t* hDisplayOutput = NULL; + uint32_t DisplayCount = 0; + ScalingCaps->Size = sizeof(ctl_scaling_caps_t); + + // Enumerate all the possible target display's for the adapters + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + if (DisplayCount <= 0) + { + printf("Invalid Display Count\n"); + goto Exit; + } + + hDisplayOutput = (ctl_display_output_handle_t*)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + Result = ctlGetSupportedScalingCapability(hDisplayOutput[idx], ScalingCaps); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSupportedScalingCapability"); + + cout << "======== GetScalingCaps ========" << endl; + cout << "ScalingCaps.SupportedScaling: " << ScalingCaps->SupportedScaling << endl; + + Exit: + CTL_FREE_MEM(hDisplayOutput); + return Result; + } + + ctl_result_t GetScalingSettings(ctl_device_adapter_handle_t hDevice, uint32_t idx, ctl_scaling_settings_t* ScalingSetting) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + ctl_display_output_handle_t* hDisplayOutput = NULL; + uint32_t DisplayCount = 0; + ctl_scaling_caps_t ScalingCaps = { 0 }; + ScalingSetting->Size = sizeof(ctl_scaling_settings_t); + + Result = GetScalingCaps(hDevice, idx, &ScalingCaps); + LOG_AND_EXIT_ON_ERROR(Result, "GetScalingCaps"); + + // Enumerate all the possible target display's for the adapters + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + if (DisplayCount <= 0) + { + printf("Invalid Display Count\n"); + goto Exit; + } + + hDisplayOutput = (ctl_display_output_handle_t*)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + if (0 != ScalingCaps.SupportedScaling) + { + Result = ctlGetCurrentScaling(hDisplayOutput[idx], ScalingSetting); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetCurrentScaling"); + + cout << "======== GetScalingSettings ========" << endl; + cout << "ScalingSetting.Enable: " << ScalingSetting->Enable << endl; + cout << "ScalingSetting.ScalingType: " << ScalingSetting->ScalingType << endl; + cout << "ScalingSetting.HardwareModeSet: " << ScalingSetting->HardwareModeSet << endl; + cout << "ScalingSetting.CustomScalingX: " << ScalingSetting->CustomScalingX << endl; + cout << "ScalingSetting.CustomScalingY: " << ScalingSetting->CustomScalingY << endl; + } + + Exit: + CTL_FREE_MEM(hDisplayOutput); + return Result; + } + + ctl_result_t SetScalingSettings(ctl_device_adapter_handle_t hDevice, uint32_t idx, ctl_scaling_settings_t ScalingSetting) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + ctl_display_output_handle_t* hDisplayOutput = NULL; + uint32_t DisplayCount = 0; + ctl_scaling_caps_t ScalingCaps = { 0 }; + bool ModeSet; + + Result = GetScalingCaps(hDevice, idx, &ScalingCaps); + LOG_AND_EXIT_ON_ERROR(Result, "GetScalingCaps"); + + // Enumerate all the possible target display's for the adapters + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + if (DisplayCount <= 0) + { + printf("Invalid Display Count\n"); + goto Exit; + } + + hDisplayOutput = (ctl_display_output_handle_t*)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + if (0 != ScalingCaps.SupportedScaling) + { + // filling custom scaling details + ScalingSetting.Size = sizeof(ctl_scaling_settings_t); + + // fill custom scaling details only if it is supported + if (0x1F == ScalingCaps.SupportedScaling) + { + // check if hardware modeset required to apply custom scaling + ModeSet = ((TRUE == ScalingSetting.Enable) && (CTL_SCALING_TYPE_FLAG_CUSTOM == ScalingSetting.ScalingType)) ? FALSE : TRUE; + ScalingSetting.HardwareModeSet = (TRUE == ModeSet) ? TRUE : FALSE; + } + + cout << "======== SetScalingSettings ========" << endl; + cout << "ScalingSetting.Enable: " << ScalingSetting.Enable << endl; + cout << "ScalingSetting.ScalingType: " << ScalingSetting.ScalingType << endl; + cout << "ScalingSetting.HardwareModeSet: " << ScalingSetting.HardwareModeSet << endl; + cout << "ScalingSetting.CustomScalingX: " << ScalingSetting.CustomScalingX << endl; + cout << "ScalingSetting.CustomScalingY: " << ScalingSetting.CustomScalingY << endl; + } + + Result = ctlSetCurrentScaling(hDisplayOutput[idx], &ScalingSetting); + LOG_AND_EXIT_ON_ERROR(Result, "ctlSetCurrentScaling"); + + Exit: + CTL_FREE_MEM(hDisplayOutput); + return Result; + } + + ctl_result_t GetSharpnessCaps(ctl_device_adapter_handle_t hDevice, uint32_t idx, ctl_sharpness_caps_t* SharpnessCaps) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + ctl_display_output_handle_t* hDisplayOutput = NULL; + uint32_t DisplayCount = 0; + SharpnessCaps->Size = sizeof(ctl_sharpness_caps_t); + + // Enumerate all the possible target display's for the adapters + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + if (DisplayCount <= 0) + { + printf("Invalid Display Count\n"); + goto Exit; + } + + hDisplayOutput = (ctl_display_output_handle_t*)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + // Get Sharpness caps + Result = ctlGetSharpnessCaps(hDisplayOutput[idx], SharpnessCaps); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSharpnessCaps"); + + cout << "======== GetSharpnessCaps ========" << endl; + cout << "SharpnessCaps.SupportedFilterFlags: " << SharpnessCaps->SupportedFilterFlags << endl; + + Exit: + CTL_FREE_MEM(hDisplayOutput); + return Result; + } + + ctl_result_t GetSharpnessSettings(ctl_device_adapter_handle_t hDevice, uint32_t idx, ctl_sharpness_settings_t* GetSharpness) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + ctl_display_output_handle_t* hDisplayOutput = NULL; + uint32_t DisplayCount = 0; + GetSharpness->Size = sizeof(ctl_sharpness_settings_t); + + // Enumerate all the possible target display's for the adapters + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + if (DisplayCount <= 0) + { + printf("Invalid Display Count\n"); + goto Exit; + } + + hDisplayOutput = (ctl_display_output_handle_t*)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + Result = ctlGetCurrentSharpness(hDisplayOutput[idx], GetSharpness); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetCurrentSharpness"); + + cout << "======== GetSharpnessSettings ========" << endl; + cout << "GetSharpness.Enable: " << GetSharpness->Enable << endl; + cout << "GetSharpness.FilterType: " << GetSharpness->FilterType << endl; + cout << "GetSharpness.Intensity: " << GetSharpness->Intensity << endl; + + Exit: + CTL_FREE_MEM(hDisplayOutput); + return Result; + } + + ctl_result_t SetSharpnessSettings(ctl_device_adapter_handle_t hDevice, uint32_t idx, ctl_sharpness_settings_t SetSharpness) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + ctl_display_output_handle_t* hDisplayOutput = NULL; + uint32_t DisplayCount = 0; + + // Enumerate all the possible target display's for the adapters + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + if (DisplayCount <= 0) + { + printf("Invalid Display Count\n"); + goto Exit; + } + + hDisplayOutput = (ctl_display_output_handle_t*)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + cout << "======== SetSharpnessSettings ========" << endl; + cout << "SetSharpness.Enable: " << SetSharpness.Enable << endl; + cout << "SetSharpness.FilterType: " << SetSharpness.FilterType << endl; + cout << "SetSharpness.Intensity: " << SetSharpness.Intensity << endl; + + Result = ctlSetCurrentSharpness(hDisplayOutput[idx], &SetSharpness); + LOG_AND_EXIT_ON_ERROR(Result, "ctlSetCurrentSharpness"); + + Exit: + CTL_FREE_MEM(hDisplayOutput); + return Result; + } + + ctl_result_t GetEnduranceGamingCaps(ctl_device_adapter_handle_t hDevice, + ctl_endurance_gaming_caps_t* pCaps) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // --- First pass: get number of 3D features --- + ctl_3d_feature_caps_t FeatureCaps3D = { 0 }; + FeatureCaps3D.Size = sizeof(ctl_3d_feature_caps_t); + + Result = ctlGetSupported3DCapabilities(hDevice, &FeatureCaps3D); + if (Result != CTL_RESULT_SUCCESS) + { + APP_LOG_ERROR("ctlGetSupported3DCapabilities failed (pass 1): 0x%X", Result); + return Result; + } + + if (FeatureCaps3D.NumSupportedFeatures == 0) + { + APP_LOG_ERROR("No 3D features supported?"); + return CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + // --- Allocate details array and zero it --- + auto details = (ctl_3d_feature_details_t*) + malloc(sizeof(ctl_3d_feature_details_t) * FeatureCaps3D.NumSupportedFeatures); + if (!details) + return CTL_RESULT_ERROR_INVALID_NULL_POINTER; + + memset(details, 0, sizeof(ctl_3d_feature_details_t) * FeatureCaps3D.NumSupportedFeatures); + + // --- Second pass: fill in the details array --- + FeatureCaps3D.pFeatureDetails = details; + Result = ctlGetSupported3DCapabilities(hDevice, &FeatureCaps3D); + if (Result != CTL_RESULT_SUCCESS) + { + APP_LOG_ERROR("ctlGetSupported3DCapabilities failed (pass 2): 0x%X", Result); + free(details); + return Result; + } + + // --- Search for the Endurance Gaming feature --- + bool found = false; + for (uint32_t i = 0; i < FeatureCaps3D.NumSupportedFeatures; ++i) + { + auto& D = details[i]; + if (D.FeatureType == CTL_3D_FEATURE_ENDURANCE_GAMING) + { + // if it's a custom property, we need to allocate pCustomValue + if (D.ValueType == CTL_PROPERTY_VALUE_TYPE_CUSTOM && D.CustomValueSize > 0) + { + D.pCustomValue = malloc(D.CustomValueSize); + if (!D.pCustomValue) + { + Result = CTL_RESULT_ERROR_INVALID_NULL_POINTER; + break; + } + + // single-feature query to fill just this one custom block + ctl_3d_feature_caps_t single = { 0 }; + single.Size = sizeof(single); + single.Version = 0; + single.NumSupportedFeatures = 1; + single.pFeatureDetails = &D; + + Result = ctlGetSupported3DCapabilities(hDevice, &single); + if (Result != CTL_RESULT_SUCCESS) + { + APP_LOG_ERROR("Single-feature ctlGetSupported3DCapabilities failed: 0x%X", Result); + } + } + + if (Result == CTL_RESULT_SUCCESS) + { + // copy the filled‐in ctl_endurance_gaming_caps_t out + auto igclCaps = reinterpret_cast(D.pCustomValue); + *pCaps = *igclCaps; + found = true; + } + + // clean up + if (D.pCustomValue) + { + free(D.pCustomValue); + D.pCustomValue = nullptr; + } + + break; + } + } + + if (!found && Result == CTL_RESULT_SUCCESS) + Result = CTL_RESULT_ERROR_UNSUPPORTED_FEATURE; + + // final cleanup + free(details); + return Result; + } + + ctl_result_t GetEnduranceGamingSettings(ctl_device_adapter_handle_t hDevice, ctl_endurance_gaming_t* pSettings) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // zero out output + memset(pSettings, 0, sizeof(*pSettings)); + + // build the get structure + ctl_3d_feature_getset_t Feature3D = { 0 }; + Feature3D.bSet = FALSE; // GET + Feature3D.FeatureType = CTL_3D_FEATURE_ENDURANCE_GAMING; + Feature3D.Size = sizeof(Feature3D); + Feature3D.ValueType = CTL_PROPERTY_VALUE_TYPE_CUSTOM; + Feature3D.CustomValueSize = sizeof(*pSettings); + Feature3D.pCustomValue = pSettings; + + // issue the call + Result = ctlGetSet3DFeature(hDevice, &Feature3D); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSet3DFeature (GetEnduranceGamingSettings)"); + + // log for debug + cout << "======== GetEnduranceGamingSettings ========" << endl; + cout << "EGControl: " << pSettings->EGControl << endl; + cout << "EGMode: " << pSettings->EGMode << endl; + /* + cout << "IsFPRequired: " << pSettings->IsFPRequired << endl; + cout << "TargetFPS: " << pSettings->TargetFPS << endl; + cout << "RefreshRate: " << pSettings->RefreshRate << endl; + */ + + Exit: + return Result; + } + + ctl_result_t SetEnduranceGamingSettings(ctl_device_adapter_handle_t hDevice, ctl_endurance_gaming_t settings) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // pack into v2 struct so we can use same API + ctl_endurance_gaming_t eg2 = { 0 }; + eg2.EGControl = settings.EGControl; + eg2.EGMode = settings.EGMode; + + // build the set structure + ctl_3d_feature_getset_t Feature3D = { 0 }; + Feature3D.bSet = TRUE; // SET + Feature3D.FeatureType = CTL_3D_FEATURE_ENDURANCE_GAMING; + Feature3D.Size = sizeof(Feature3D); + Feature3D.ValueType = CTL_PROPERTY_VALUE_TYPE_CUSTOM; + Feature3D.CustomValueSize = sizeof(eg2); + Feature3D.pCustomValue = &eg2; + + // issue the call + Result = ctlGetSet3DFeature(hDevice, &Feature3D); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSet3DFeature (SetEnduranceGamingSettings)"); + + // log for debug + cout << "======== SetEnduranceGamingSettings ========" << endl; + cout << "EGControl now: " << eg2.EGControl << endl; + cout << "EGMode now: " << eg2.EGMode << endl; + + Exit: + return Result; + } + + + ctl_result_t SetFramesPerSecondLimit(ctl_device_adapter_handle_t hDevice, bool isEnabled, int32_t fpslimit) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // build the set structure + ctl_3d_feature_getset_t Feature3D = { 0 }; + Feature3D.bSet = TRUE; + Feature3D.FeatureType = CTL_3D_FEATURE_FRAME_LIMIT; + Feature3D.Size = sizeof(Feature3D); + Feature3D.ValueType = CTL_PROPERTY_VALUE_TYPE_INT32; + Feature3D.CustomValueSize = 0; + Feature3D.pCustomValue = NULL; + Feature3D.Value.IntType.Enable = isEnabled; // Enable or Disable FPS limiter + Feature3D.Value.IntType.Value = fpslimit; // Set the actual frame limit + Feature3D.Version = 0; + + + // issue the call + Result = ctlGetSet3DFeature(hDevice, &Feature3D); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSet3DFeature (SetFramesPerSecondLimit)"); + + // log for debug + cout << "======== SetFramesPerSecondLimit ========" << endl; + cout << "IntType.Enable: " << isEnabled << endl; + cout << "IntType.Value: " << fpslimit << endl; + + Exit: + return Result; + } + + + ctl_result_t GetFramesPerSecondLimit(ctl_device_adapter_handle_t hDevice, ctl_fps_limiter_t* fpslimiter) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // build the get structure + ctl_3d_feature_getset_t Feature3D = { 0 }; + Feature3D.bSet = FALSE; // GET + Feature3D.FeatureType = CTL_3D_FEATURE_FRAME_LIMIT; + Feature3D.Size = sizeof(Feature3D); + Feature3D.ValueType = CTL_PROPERTY_VALUE_TYPE_INT32; + Feature3D.CustomValueSize = 0; + Feature3D.pCustomValue = NULL; + Feature3D.Version = 0; + + // issue the call + Result = ctlGetSet3DFeature(hDevice, &Feature3D); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSet3DFeature (GetFramesPerSecondLimit)"); + + // log for debug + cout << "======== GetFramesPerSecondLimit ========" << endl; + cout << "Value.IntType.Enable: " << Feature3D.Value.IntType.Enable << endl; + cout << "Value.IntType.Value: " << Feature3D.Value.IntType.Value << endl; + + fpslimiter->isLimiterEnabled = Feature3D.Value.IntType.Enable; + fpslimiter->fpsLimitValue = Feature3D.Value.IntType.Value; + + Exit: + return Result; + } + + + ctl_result_t SetLowLatencySetting(ctl_device_adapter_handle_t hDevice, ctl_3d_low_latency_types_t setting) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // build the set structure + ctl_3d_feature_getset_t Feature3D = { 0 }; + Feature3D.bSet = TRUE; + Feature3D.FeatureType = CTL_3D_FEATURE_LOW_LATENCY; + Feature3D.Size = sizeof(Feature3D); + Feature3D.CustomValueSize = 0; + Feature3D.pCustomValue = NULL; + Feature3D.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; + Feature3D.Value.EnumType.EnableType = setting; // Set Low Latency Setting + Feature3D.Version = 0; + + // issue the call + Result = ctlGetSet3DFeature(hDevice, &Feature3D); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSet3DFeature (SetLowLatencySetting)"); + + // log for debug + cout << "======== SetLowLatencySetting ========" << endl; + cout << "Value.EnumType.EnableType: " << setting << endl; + + + Exit: + return Result; + } + + + ctl_result_t GetLowLatencySetting(ctl_device_adapter_handle_t hDevice, ctl_3d_low_latency_types_t* setting) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // build the get structure + ctl_3d_feature_getset_t Feature3D = { 0 }; + Feature3D.bSet = FALSE; // GET + Feature3D.FeatureType = CTL_3D_FEATURE_LOW_LATENCY; + Feature3D.Size = sizeof(Feature3D); + Feature3D.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; + Feature3D.CustomValueSize = 0; + Feature3D.pCustomValue = NULL; + Feature3D.Version = 0; + + // issue the call + Result = ctlGetSet3DFeature(hDevice, &Feature3D); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSet3DFeature (GetFramesPerSecondLimit)"); + + // log for debug + cout << "======== GetFramesPerSecondLimit ========" << endl; + *setting = (ctl_3d_low_latency_types_t)Feature3D.Value.EnumType.EnableType; + cout << "Value.EnumType.EnableType: " << *setting << endl; + + Exit: + return Result; + } + + + ctl_result_t SetFrameSyncSetting(ctl_device_adapter_handle_t hDevice, ctl_gaming_flip_mode_flag_t setting) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // build the set structure + ctl_3d_feature_getset_t Feature3D = { 0 }; + Feature3D.bSet = TRUE; + Feature3D.FeatureType = CTL_3D_FEATURE_GAMING_FLIP_MODES; + Feature3D.Size = sizeof(Feature3D); + Feature3D.CustomValueSize = 0; + Feature3D.pCustomValue = NULL; + Feature3D.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; + Feature3D.Value.EnumType.EnableType = setting; // Set Frame Sync Type + Feature3D.Version = 0; + + // issue the call + Result = ctlGetSet3DFeature(hDevice, &Feature3D); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSet3DFeature (SetFrameSyncSetting)"); + + // log for debug + cout << "======== SetFrameSyncSetting ========" << endl; + cout << "Value.EnumType.EnableType: " << setting << endl; + + + Exit: + return Result; + } + + + ctl_result_t GetFrameSyncSetting(ctl_device_adapter_handle_t hDevice, ctl_gaming_flip_mode_flag_t* setting) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // build the get structure + ctl_3d_feature_getset_t Feature3D = { 0 }; + Feature3D.bSet = FALSE; // GET + Feature3D.FeatureType = CTL_3D_FEATURE_GAMING_FLIP_MODES; + Feature3D.Size = sizeof(Feature3D); + Feature3D.ValueType = CTL_PROPERTY_VALUE_TYPE_ENUM; + Feature3D.CustomValueSize = 0; + Feature3D.pCustomValue = NULL; + Feature3D.Version = 0; + + // issue the call + Result = ctlGetSet3DFeature(hDevice, &Feature3D); + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetSet3DFeature (GetFrameSyncSetting)"); + + // log for debug + cout << "======== GetFrameSyncSetting ========" << endl; + *setting = (ctl_gaming_flip_mode_flag_t)Feature3D.Value.EnumType.EnableType; + cout << "Value.EnumType.EnableType: " << *setting << endl; + + Exit: + return Result; + } + + // Get the list of Intel device handles + ctl_device_adapter_handle_t* EnumerateDevices(uint32_t* pAdapterCount) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + hDevices = NULL; + + // Get the number of Intel Adapters + Result = ctlEnumerateDevices(hAPIHandle, pAdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + + // Allocate memory for the device handles + hDevices = (ctl_device_adapter_handle_t*)malloc(sizeof(ctl_device_adapter_handle_t) * (*pAdapterCount)); + EXIT_ON_MEM_ALLOC_FAILURE(hDevices, "EnumerateDevices"); + + // Get the device handles + Result = ctlEnumerateDevices(hAPIHandle, pAdapterCount, hDevices); + LOG_AND_EXIT_ON_ERROR(Result, "ctlEnumerateDevices"); + + Exit: + return hDevices; + } + + /*************************************************************** + * @brief + * GenerateHueSaturationMatrix + * @param Hue, Saturation, CoEff[3][3] + * @return void + ***************************************************************/ + void GenerateHueSaturationMatrix(double Hue, double Saturation, double CoEff[3][3]) + { + double HueShift = Hue * Pi / 180.0; + double C = cos(HueShift); + double S = sin(HueShift); + double HueRotationMatrix[3][3] = { { 1.0, 0.0, 0.0 }, { 0.0, C, -S }, { 0.0, S, C } }; + double SaturationEnhancementMatrix[3][3] = { { 1.0, 0.0, 0.0 }, { 0.0, Saturation, 0.0 }, { 0.0, 0.0, Saturation } }; + double YCbCr2RGB709[3][3] = { { 1.0000, 0.0000, 1.5748 }, { 1.0000, -0.1873, -0.4681 }, { 1.0000, 1.8556, 0.0000 } }; + double RGB2YCbCr709[3][3] = { { 0.2126, 0.7152, 0.0722 }, { -0.1146, -0.3854, 0.5000 }, { 0.5000, -0.4542, -0.0458 } }; + + double Result[3][3]; + + // Use Bt.709 coefficients for RGB to YCbCr conversion + MatrixMult3x3(YCbCr2RGB709, SaturationEnhancementMatrix, Result); + MatrixMult3x3(Result, HueRotationMatrix, Result); + MatrixMult3x3(Result, RGB2YCbCr709, Result); + + memcpy_s(CoEff, sizeof(Result), Result, sizeof(Result)); + } + + /*************************************************************** + * @brief + * ApplyHueSaturation + * General steps for Hue Saturaion + * Create a CSC matrix based on mentioned algorithm for given hue-sat values + * Do a set CSC call with created matrix. + * Iterate through blocks PixTxCaps and find the CSC block. + * @param hDisplayOutput , pPixTxCaps, CscBlockIndex, Hue, Saturation + * @return ctl_result_t + ***************************************************************/ +ctl_result_t ApplyHueSaturation(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t *pPixTxCaps, int32_t CscBlockIndex, double Hue, double Saturation) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_pixtx_block_config_t CSCConfig = pPixTxCaps->pBlockConfigs[CscBlockIndex]; + CSCConfig.Size = sizeof(ctl_pixtx_block_config_t); + Saturation = CLIP_DOUBLE(Saturation, 0.0, 2.5); + Hue = CLIP_DOUBLE(Hue, 0, 359); + + if ((0 == Hue) && (0 == Saturation)) + { + // If Hue and Saturation both are set to default, CSC coefficients should be identity matrix. + memset(CSCConfig.Config.MatrixConfig.Matrix, 0, sizeof(CSCConfig.Config.MatrixConfig.Matrix)); + + CSCConfig.Config.MatrixConfig.Matrix[0][0] = CSCConfig.Config.MatrixConfig.Matrix[1][1] = CSCConfig.Config.MatrixConfig.Matrix[2][2] = 1.0; + } + else + { + // Below function generates CSC matrix(Non Linear) for given Hue and Satuartion values. + GenerateHueSaturationMatrix(Hue, Saturation, CSCConfig.Config.MatrixConfig.Matrix); + } + + ctl_pixtx_pipe_set_config_t SetPixTxArgs = { 0 }; + SetPixTxArgs.Size = sizeof(ctl_pixtx_pipe_set_config_t); + SetPixTxArgs.OpertaionType = CTL_PIXTX_CONFIG_OPERTAION_TYPE_SET_CUSTOM; + SetPixTxArgs.NumBlocks = 1; // We are trying to set only one block + SetPixTxArgs.pBlockConfigs = &CSCConfig; // for CSC block + SetPixTxArgs.pBlockConfigs->BlockId = pPixTxCaps->pBlockConfigs[CscBlockIndex].BlockId; + + Result = ctlPixelTransformationSetConfig(hDisplayOutput, &SetPixTxArgs); + LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationSetConfig"); + +Exit: + return Result; +} + +/*************************************************************** + * @brief + * GetSRGBDecodingValue + * @param Input + * @return double + ***************************************************************/ +double GetSRGBDecodingValue(double Input) +{ + + // https://en.wikipedia.org/wiki/SRGB#Transfer_function_(%22gamma%22) + + double Output; + + if (Input <= 0.04045) + { + Output = Input / 12.92; + } + else + { + Output = pow(((Input + 0.055) / 1.055), 2.4); + } + + return Output; +} + +/*************************************************************** + * @brief + * GetSRGBEncodingValue + * @param Input + * @return double + ***************************************************************/ +double GetSRGBEncodingValue(double Input) +{ + /* + https://en.wikipedia.org/wiki/SRGB#The_forward_transformation_.28CIE_xyY_or_CIE_XYZ_to_sRGB.29 + */ + + double Output; + + if (Input <= 0.0031308) + { + Output = Input * 12.92; + } + else + { + Output = (1.055 * pow(Input, 1.0 / 2.4)) - 0.055; + } + + return Output; +} + + +/*************************************************************** + * @brief + * Set DeGamma Lut + * @param hDisplayOutput + * @param *pPixTxCaps + * @param DGLUTIndex + * @return + ***************************************************************/ +ctl_result_t SetDeGammaLut(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t* pPixTxCaps, int32_t DGLUTIndex) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + + if (nullptr == hDisplayOutput) + { + return CTL_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (nullptr == pPixTxCaps) + { + return CTL_RESULT_ERROR_INVALID_NULL_POINTER; + } + + ctl_pixtx_pipe_set_config_t SetPixTxArgs = { 0 }; + ctl_pixtx_block_config_t LutConfig = pPixTxCaps->pBlockConfigs[DGLUTIndex]; + LutConfig.Size = sizeof(ctl_pixtx_block_config_t); + LutConfig.Config.OneDLutConfig.pSamplePositions = NULL; + double* pLut; + + // Create a valid 1D LUT. + const uint32_t LutSize = LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels; + LutConfig.Config.OneDLutConfig.pSampleValues = (double*)malloc(LutSize * sizeof(double)); + + EXIT_ON_MEM_ALLOC_FAILURE(LutConfig.Config.OneDLutConfig.pSampleValues, " LutConfig.Config.OneDLutConfig.pSampleValues"); + + memset(LutConfig.Config.OneDLutConfig.pSampleValues, 0, LutSize * sizeof(double)); + + SetPixTxArgs.Size = sizeof(ctl_pixtx_pipe_set_config_t); + SetPixTxArgs.OpertaionType = CTL_PIXTX_CONFIG_OPERTAION_TYPE_SET_CUSTOM; + SetPixTxArgs.NumBlocks = 1; // We are enabling only one block + SetPixTxArgs.pBlockConfigs = &LutConfig; // for 1DLUT block + + pLut = LutConfig.Config.OneDLutConfig.pSampleValues; + + for (uint32_t i = 0; i < (LutSize / LutConfig.Config.OneDLutConfig.NumChannels); i++) + { + double Input = (double)i / (double)(LutSize - 1); + pLut[i] = GetSRGBDecodingValue(Input); + // pLut[i] = Input; // unity + } + + Result = ctlPixelTransformationSetConfig(hDisplayOutput, &SetPixTxArgs); + + LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "ctlPixelTransformationSetConfig"); + +Exit: + CTL_FREE_MEM(LutConfig.Config.OneDLutConfig.pSampleValues); + return Result; +} + +/*************************************************************** + * @brief + * Get DeGamma + * @param ctl_display_output_handle_t ,ctl_pixtx_pipe_get_config_t, int32_t + * @return + ***************************************************************/ +ctl_result_t GetDeGammaLut(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t* pPixTxCaps, int32_t DGLUTIndex) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + + if (nullptr == hDisplayOutput) + { + return CTL_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (nullptr == pPixTxCaps) + { + return CTL_RESULT_ERROR_INVALID_NULL_POINTER; + } + + ctl_pixtx_pipe_get_config_t GetPixTxCurrentArgs = { 0 }; + GetPixTxCurrentArgs.Size = sizeof(ctl_pixtx_pipe_get_config_t); + ctl_pixtx_block_config_t LutConfig = pPixTxCaps->pBlockConfigs[DGLUTIndex]; + + GetPixTxCurrentArgs.QueryType = CTL_PIXTX_CONFIG_QUERY_TYPE_CURRENT; + GetPixTxCurrentArgs.NumBlocks = 1; // We are trying to query only one block + GetPixTxCurrentArgs.pBlockConfigs = &LutConfig; // Providing Lut config + LutConfig.Config.OneDLutConfig.pSampleValues = (double*)malloc(LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels * sizeof(double)); + + EXIT_ON_MEM_ALLOC_FAILURE(LutConfig.Config.OneDLutConfig.pSampleValues, "LutConfig.Config.OneDLutConfig.pSampleValues"); + + memset(LutConfig.Config.OneDLutConfig.pSampleValues, 0, LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels * sizeof(double)); + + Result = ctlPixelTransformationGetConfig(hDisplayOutput, &GetPixTxCurrentArgs); + LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationGetConfig"); + + APP_LOG_INFO("DEGamma values : LutConfig.Config.OneDLutConfig.pSampleValues"); + + uint32_t LutDataSize = LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels; + APP_LOG_INFO("LutDataSize = %d ", LutDataSize); + + APP_LOG_INFO("DeGamma values : LutConfig.Config.OneDLutConfig.pSampleValues"); + + for (uint32_t i = 0; i < LutDataSize; i++) + { + APP_LOG_INFO("[%d] = %f", i, LutConfig.Config.OneDLutConfig.pSampleValues[i]); + } + +Exit: + CTL_FREE_MEM(LutConfig.Config.OneDLutConfig.pSampleValues); + return Result; +} + +/*************************************************************** + * @brief + * SetGammaLut + * @param hDisplayOutput ,pPixTxCaps, OneDLUTIndex + * @return ctl_result_t + ***************************************************************/ +ctl_result_t SetGammaLut(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t* pPixTxCaps, int32_t OneDLUTIndex) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_pixtx_block_config_t LutConfig = pPixTxCaps->pBlockConfigs[OneDLUTIndex]; + + LutConfig.Size = sizeof(ctl_pixtx_block_config_t); + LutConfig.Config.OneDLutConfig.SamplingType = CTL_PIXTX_LUT_SAMPLING_TYPE_UNIFORM; + LutConfig.Config.OneDLutConfig.NumChannels = 3; + LutConfig.Config.OneDLutConfig.pSamplePositions = NULL; + + ctl_pixtx_pipe_set_config_t SetPixTxArgs = { 0 }; + SetPixTxArgs.Size = sizeof(ctl_pixtx_pipe_set_config_t); + SetPixTxArgs.OpertaionType = CTL_PIXTX_CONFIG_OPERTAION_TYPE_SET_CUSTOM; + SetPixTxArgs.NumBlocks = 1; // We are enabling only one block + SetPixTxArgs.pBlockConfigs = &LutConfig; // for 1DLUT block + + double* pRedLut, * pGreenLut, * pBlueLut; + double LutMultiplier; + + // Create a valid 1D LUT. + const uint32_t LutSize = LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels; + LutConfig.Config.OneDLutConfig.pSampleValues = (double*)malloc(LutSize * sizeof(double)); + + EXIT_ON_MEM_ALLOC_FAILURE(LutConfig.Config.OneDLutConfig.pSampleValues, " LutConfig.Config.OneDLutConfig.pSampleValues"); + + pRedLut = LutConfig.Config.OneDLutConfig.pSampleValues; + pGreenLut = pRedLut + LutConfig.Config.OneDLutConfig.NumSamplesPerChannel; + pBlueLut = pGreenLut + LutConfig.Config.OneDLutConfig.NumSamplesPerChannel; + + // Applying a LUT which reduces the Red channel values by 30%.in linear format + // Based on the Pixel Encoding type , encode the multiplier 0.7 with the same function + // For example if Encoding is ST2084 then OETF2084(0.7) -> 0.962416136 + // if Encoding is SRGB then sRGB(0.7) -> 0.854305832 + + if (CTL_PIXTX_GAMMA_ENCODING_TYPE_ST2084 == pPixTxCaps->OutputPixelFormat.EncodingType) + { + LutMultiplier = 0.962416136; + } + else if (CTL_PIXTX_GAMMA_ENCODING_TYPE_SRGB == pPixTxCaps->OutputPixelFormat.EncodingType) + { + LutMultiplier = 0.854305832; + } + else + { + LutMultiplier = 1.0; + } + + // When calling Set for just OneDLUT the LUT is expected to be a Relative Correction LUT + for (uint32_t i = 0; i < LutConfig.Config.OneDLutConfig.NumSamplesPerChannel; i++) + { + double Input = (double)i / (double)(LutConfig.Config.OneDLutConfig.NumSamplesPerChannel - 1); + pRedLut[i] = pGreenLut[i] = pBlueLut[i] = Input; + pRedLut[i] *= LutMultiplier; + } + + Result = ctlPixelTransformationSetConfig(hDisplayOutput, &SetPixTxArgs); + LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "ctlPixelTransformationSetConfig"); + +Exit: + CTL_FREE_MEM(LutConfig.Config.OneDLutConfig.pSampleValues); + return Result; +} + +/*************************************************************** + * @brief + * GetGammaLut + * @param hDisplayOutput ,pPixTxCaps, OneDLUTIndex + * @return ctl_result_t + ***************************************************************/ +ctl_result_t GetGammaLut(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t* pPixTxCaps, int32_t OneDLUTIndex) +{ + ctl_pixtx_pipe_get_config_t GetPixTxCurrentArgs = { 0 }; + GetPixTxCurrentArgs.Size = sizeof(ctl_pixtx_pipe_get_config_t); + ctl_pixtx_block_config_t LutConfig = pPixTxCaps->pBlockConfigs[OneDLUTIndex]; + ctl_result_t Result = CTL_RESULT_SUCCESS; + + GetPixTxCurrentArgs.QueryType = CTL_PIXTX_CONFIG_QUERY_TYPE_CURRENT; + GetPixTxCurrentArgs.NumBlocks = 1; // We are trying to query only one block + GetPixTxCurrentArgs.pBlockConfigs = &LutConfig; // Providing Lut config + LutConfig.Config.OneDLutConfig.pSampleValues = (double*)malloc(LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels * sizeof(double)); + + EXIT_ON_MEM_ALLOC_FAILURE(LutConfig.Config.OneDLutConfig.pSampleValues, "LutConfig.Config.OneDLutConfig.pSampleValues"); + + memset(LutConfig.Config.OneDLutConfig.pSampleValues, 0, LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels * sizeof(double)); + + Result = ctlPixelTransformationGetConfig(hDisplayOutput, &GetPixTxCurrentArgs); + LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationGetConfig"); + + uint32_t LutDataSize = LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels; + APP_LOG_INFO("LutDataSize = %d ", LutDataSize); + + APP_LOG_INFO("Gamma values : LutConfig.Config.OneDLutConfig.pSampleValues"); + + for (uint32_t i = 0; i < LutDataSize; i++) + { + APP_LOG_INFO("[%d] = %f", i, LutConfig.Config.OneDLutConfig.pSampleValues[i]); + } + +Exit: + CTL_FREE_MEM(LutConfig.Config.OneDLutConfig.pSampleValues); + return Result; +} + +/*************************************************************** + * @brief + * Get Set DeGamma + * Iterate through blocks PixTxCaps and find the LUT. + * @param ctl_display_output_handle_t ,ctl_pixtx_pipe_get_config_t + * @return + ***************************************************************/ +void GetSetDeGamma(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t *pPixTxCaps) +{ + // One approach could be check for CSC with offsets block, the block right before CSC with offset block is DGLUT. + + ctl_result_t Result = CTL_RESULT_SUCCESS; + int32_t DGLUTIndex = -1; + + for (uint32_t i = 0; i < pPixTxCaps->NumBlocks; i++) + { + if ((CTL_PIXTX_BLOCK_TYPE_1D_LUT == pPixTxCaps->pBlockConfigs[i].BlockType) && (CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX_AND_OFFSETS == pPixTxCaps->pBlockConfigs[i + 1].BlockType)) + { + DGLUTIndex = i; + break; + } + } + + if (DGLUTIndex < 0) + { + APP_LOG_ERROR("Invalid DGLut Index"); + goto Exit; + } + + // Set DeGamma + Result = SetDeGammaLut(hDisplayOutput, pPixTxCaps, DGLUTIndex); + if (CTL_RESULT_SUCCESS != Result) + { + APP_LOG_ERROR("SetDeGammaLut call failed"); + STORE_AND_RESET_ERROR(Result); + } + else + { + // Get DeGamma + Result = GetDeGammaLut(hDisplayOutput, pPixTxCaps, DGLUTIndex); + if (CTL_RESULT_SUCCESS != Result) + { + APP_LOG_ERROR("GetDeGamma call failed"); + LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "GetDeGammaLut"); + } + } + +Exit: + return; +} + +/*************************************************************** + * @brief + * Get Set Gamma + * Iterate through blocks PixTxCaps and find the LUT. + * @param ctl_display_output_handle_t ,ctl_pixtx_pipe_get_config_t + * @return + ***************************************************************/ +void GetSetGamma(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t *pPixTxCaps) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + + // One approach could be check for CSC with offsets block, the block right after CSC with offset block is GLUT. + // In HDR mode only one 1DLUT block will be reported and that is of GLUT. So, need to take last occurrence of 1DLUT block in consideration. + + int32_t OneDLUTIndex = -1; + + for (uint8_t i = 0; i < pPixTxCaps->NumBlocks; i++) + { + // Need to consider the last 1DLUT block for Gamma + if (CTL_PIXTX_BLOCK_TYPE_1D_LUT == pPixTxCaps->pBlockConfigs[i].BlockType) + { + OneDLUTIndex = i; + } + } + + if (OneDLUTIndex < 0) + { + APP_LOG_ERROR("Invalid OneDLut Index"); + goto Exit; + } + + // Set Gamma + Result = SetGammaLut(hDisplayOutput, pPixTxCaps, OneDLUTIndex); + + if (CTL_RESULT_SUCCESS != Result) + { + APP_LOG_ERROR("SetGammaLut call failed"); + STORE_AND_RESET_ERROR(Result); + } + else + { + // Get Gamma + Result = GetGammaLut(hDisplayOutput, pPixTxCaps, OneDLUTIndex); + LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "GetGammaLut"); + } + +Exit: + return; +} + +/*************************************************************** + * @brief + * ApplyLinearCSC DGLUT->CSC->GLUT + * @param hDisplayOutput + * @param pPixTxCaps + * @return + ***************************************************************/ +ctl_result_t ApplyLinearCSC(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t *pPixTxCaps) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + + if (nullptr == hDisplayOutput) + { + return CTL_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (nullptr == pPixTxCaps) + { + return CTL_RESULT_ERROR_INVALID_NULL_POINTER; + } + + // One approach could be check for CSC with offsets block, the block right before CSC with offset block is DGLUT and the Block Right after CSC with Offsets block is GLUT. + + // In HDR mode only one 1DLUT block will be reported and that is of GLUT. So, need to take last occurrence of 1DLUT block in consideration. + + int32_t DGLUTIndex, CscIndex, GLUTIndex; + DGLUTIndex = CscIndex = GLUTIndex = -1; + uint32_t OneDLutOccurances = 0; + + for (uint32_t i = 0; i < pPixTxCaps->NumBlocks; i++) + { + if (CTL_PIXTX_BLOCK_TYPE_1D_LUT == pPixTxCaps->pBlockConfigs[i].BlockType) + { + if ((CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX_AND_OFFSETS == pPixTxCaps->pBlockConfigs[i + 1].BlockType) && (CTL_PIXTX_BLOCK_TYPE_1D_LUT == pPixTxCaps->pBlockConfigs[i + 2].BlockType)) + { + DGLUTIndex = i; + CscIndex = i + 1; + GLUTIndex = i + 2; + } + break; + } + } + + if (DGLUTIndex < 0 || CscIndex < 0 || GLUTIndex < 0) + { + APP_LOG_ERROR("Invalid Index for DGLUT/CSC/GLUT"); + return CTL_RESULT_ERROR_INVALID_ARGUMENT; + } + + ctl_pixtx_block_config_t DGLUTConfig = pPixTxCaps->pBlockConfigs[DGLUTIndex]; + ctl_pixtx_block_config_t CSCConfig = pPixTxCaps->pBlockConfigs[CscIndex]; + ctl_pixtx_block_config_t GLUTConfig = pPixTxCaps->pBlockConfigs[GLUTIndex]; + + ctl_pixtx_pipe_set_config_t SetPixTxArgs = { 0 }; + SetPixTxArgs.Size = sizeof(ctl_pixtx_pipe_set_config_t); + SetPixTxArgs.OpertaionType = CTL_PIXTX_CONFIG_OPERTAION_TYPE_SET_CUSTOM; + SetPixTxArgs.NumBlocks = 3; // We are trying to set only one block + SetPixTxArgs.pBlockConfigs = (ctl_pixtx_block_config_t *)malloc(SetPixTxArgs.NumBlocks * sizeof(ctl_pixtx_block_config_t)); + EXIT_ON_MEM_ALLOC_FAILURE(SetPixTxArgs.pBlockConfigs, " SetPixTxArgs.pBlockConfigs"); + + memset(SetPixTxArgs.pBlockConfigs, 0, SetPixTxArgs.NumBlocks * sizeof(ctl_pixtx_block_config_t)); + + // DGLUT values + const uint32_t DGLutSize = DGLUTConfig.Config.OneDLutConfig.NumSamplesPerChannel * DGLUTConfig.Config.OneDLutConfig.NumChannels; + SetPixTxArgs.pBlockConfigs[0].BlockId = DGLUTConfig.BlockId; + SetPixTxArgs.pBlockConfigs[0].BlockType = DGLUTConfig.BlockType; + SetPixTxArgs.pBlockConfigs[0].Config.OneDLutConfig.NumChannels = DGLUTConfig.Config.OneDLutConfig.NumChannels; + SetPixTxArgs.pBlockConfigs[0].Config.OneDLutConfig.NumSamplesPerChannel = DGLUTConfig.Config.OneDLutConfig.NumSamplesPerChannel; + SetPixTxArgs.pBlockConfigs[0].Config.OneDLutConfig.SamplingType = DGLUTConfig.Config.OneDLutConfig.SamplingType; + SetPixTxArgs.pBlockConfigs[0].Config.OneDLutConfig.pSampleValues = (double *)malloc(DGLutSize * sizeof(double)); + + EXIT_ON_MEM_ALLOC_FAILURE(SetPixTxArgs.pBlockConfigs[0].Config.OneDLutConfig.pSampleValues, " SetPixTxArgs.pBlockConfigs[0].Config.OneDLutConfig.pSampleValues"); + + memset(SetPixTxArgs.pBlockConfigs[0].Config.OneDLutConfig.pSampleValues, 0, DGLutSize * sizeof(double)); + + for (uint32_t i = 0; i < (DGLutSize / DGLUTConfig.Config.OneDLutConfig.NumChannels); i++) + { + double Input = (double)i / (double)(DGLutSize - 1); + SetPixTxArgs.pBlockConfigs[0].Config.OneDLutConfig.pSampleValues[i] = GetSRGBDecodingValue(Input); + } + + // CSC Values + double PostOffsets[3] = { 0, 0, 0 }; + double PreOffsets[3] = { 0, 0, 0 }; + double Matrix[3][3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; // Identity Matrix + // double Matrix[3][3] = { { 0, 0, 1 }, { 0, 1, 0 }, { 1, 0, 0 } }; // Red Blue swap Matrix + SetPixTxArgs.pBlockConfigs[1].BlockId = CSCConfig.BlockId; + SetPixTxArgs.pBlockConfigs[1].BlockType = CSCConfig.BlockType; + + // Create a valid CSC Matrix. + for (uint32_t i = 0; i < 3; i++) + { + CSCConfig.Config.MatrixConfig.PreOffsets[i] = PreOffsets[i]; + } + for (uint32_t i = 0; i < 3; i++) + { + CSCConfig.Config.MatrixConfig.PostOffsets[i] = PostOffsets[i]; + } + + memcpy_s(SetPixTxArgs.pBlockConfigs[1].Config.MatrixConfig.Matrix, sizeof(SetPixTxArgs.pBlockConfigs[1].Config.MatrixConfig.Matrix), Matrix, sizeof(Matrix)); + + // GLUT Values + // Create a valid 1D LUT. + const uint32_t GLutSize = GLUTConfig.Config.OneDLutConfig.NumSamplesPerChannel * GLUTConfig.Config.OneDLutConfig.NumChannels; + SetPixTxArgs.pBlockConfigs[2].BlockId = GLUTConfig.BlockId; + SetPixTxArgs.pBlockConfigs[2].BlockType = GLUTConfig.BlockType; + SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.NumChannels = GLUTConfig.Config.OneDLutConfig.NumChannels; + SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.NumSamplesPerChannel = GLUTConfig.Config.OneDLutConfig.NumSamplesPerChannel; + SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.SamplingType = GLUTConfig.Config.OneDLutConfig.SamplingType; + SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.pSampleValues = (double *)malloc(GLutSize * sizeof(double)); + + EXIT_ON_MEM_ALLOC_FAILURE(SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.pSampleValues, " SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.pSampleValues"); + + memset(SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.pSampleValues, 0, GLutSize * sizeof(double)); + + double *pRedLut = SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.pSampleValues; + double *pGreenLut = pRedLut + SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.NumSamplesPerChannel; + double *pBlueLut = pGreenLut + SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.NumSamplesPerChannel; + + for (uint32_t i = 0; i < (GLutSize / SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.NumChannels); i++) + { + double Input = (double)i / (double)((GLutSize / SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.NumChannels) - 1); + pRedLut[i] = pGreenLut[i] = pBlueLut[i] = GetSRGBEncodingValue(Input); + } + + Result = ctlPixelTransformationSetConfig(hDisplayOutput, &SetPixTxArgs); + LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "ctlPixelTransformationSetConfig"); + +Exit: + if (NULL != SetPixTxArgs.pBlockConfigs) + { + CTL_FREE_MEM(SetPixTxArgs.pBlockConfigs[0].Config.OneDLutConfig.pSampleValues); + CTL_FREE_MEM(SetPixTxArgs.pBlockConfigs[2].Config.OneDLutConfig.pSampleValues); + } + CTL_FREE_MEM(SetPixTxArgs.pBlockConfigs); + return Result; +} + + +/*************************************************************** + * @brief + * GetPixTxCapability + * @param hDisplayOutput ,pPixTxCaps + * @return ctl_result_t + ***************************************************************/ +ctl_result_t GetPixTxCapability(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t *pPixTxCaps) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + + Result = ctlPixelTransformationGetConfig(hDisplayOutput, pPixTxCaps); + LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationGetConfig for query type capability"); + + // Number of blocks + APP_LOG_INFO("GetPixTxCapsArgs.NumBlocks = %d", pPixTxCaps->NumBlocks); + + if (NULL == pPixTxCaps->pBlockConfigs) + { + goto Exit; + } + + for (uint8_t i = 0; i < pPixTxCaps->NumBlocks; i++) + { + ctl_pixtx_1dlut_config_t *pOneDLutConfig = &pPixTxCaps->pBlockConfigs[i].Config.OneDLutConfig; + + // Block specific information + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].BlockId = %d", i, pPixTxCaps->pBlockConfigs[i].BlockId); + if (CTL_PIXTX_BLOCK_TYPE_1D_LUT == pPixTxCaps->pBlockConfigs[i].BlockType) + { + APP_LOG_INFO("Block type is CTL_PIXTX_BLOCK_TYPE_1D_LUT"); + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].Config.OneDLutConfig.NumChannels = %d", i, pOneDLutConfig->NumChannels); + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].Config.OneDLutConfig.NumSamplesPerChannel = %d", i, pOneDLutConfig->NumSamplesPerChannel); + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].Config.OneDLutConfig.SamplingType = %d", i, pOneDLutConfig->SamplingType); + } + else if (CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX == pPixTxCaps->pBlockConfigs[i].BlockType) + { + APP_LOG_INFO("Block type is CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX"); + } + else if (CTL_PIXTX_BLOCK_TYPE_3D_LUT == pPixTxCaps->pBlockConfigs[i].BlockType) + { + APP_LOG_INFO("Block type is CTL_PIXTX_BLOCK_TYPE_3D_LUT"); + APP_LOG_INFO("pPixTxCaps->pBlockConfigs[%d].Config.ThreeDLutConfig.NumSamplesPerChannel = %d", i, pPixTxCaps->pBlockConfigs[i].Config.ThreeDLutConfig.NumSamplesPerChannel); + } + else if (CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX_AND_OFFSETS == pPixTxCaps->pBlockConfigs[i].BlockType) + { + APP_LOG_INFO("Block type is CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX_AND_OFFSETS"); + } + } + +Exit: + return Result; +} + + + ctl_result_t GetDeviceProperties(ctl_device_adapter_handle_t hDevice, ctl_device_adapter_properties_t* StDeviceAdapterProperties) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + StDeviceAdapterProperties->Size = sizeof(ctl_device_adapter_properties_t); + StDeviceAdapterProperties->pDeviceID = malloc(sizeof(LUID)); + StDeviceAdapterProperties->device_id_size = sizeof(LUID); + StDeviceAdapterProperties->Version = 2; + + Result = ctlGetDeviceProperties(hDevice, StDeviceAdapterProperties); + + if (CTL_RESULT_ERROR_UNSUPPORTED_VERSION == Result) // reduce version if required & recheck + { + printf("ctlGetDeviceProperties() version mismatch - Reducing version to 0 and retrying\n"); + StDeviceAdapterProperties->Version = 0; + Result = ctlGetDeviceProperties(hDevice, StDeviceAdapterProperties); + } + + cout << "======== GetDeviceProperties ========" << endl; + cout << "StDeviceAdapterProperties.Name: " << StDeviceAdapterProperties->name << endl; + + LOG_AND_EXIT_ON_ERROR(Result, "ctlGetDeviceProperties"); + + Exit: + return Result; + } + + ctl_result_t GetTelemetryData(ctl_device_adapter_handle_t hDevice, ctl_telemetry_data* TelemetryData) + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_power_telemetry_t pPowerTelemetry = {}; + pPowerTelemetry.Size = sizeof(ctl_power_telemetry_t); + + Result = ctlPowerTelemetryGet(hDevice, &pPowerTelemetry); + if (Result != CTL_RESULT_SUCCESS) + goto Exit; + + prevtimestamp = curtimestamp; + curtimestamp = pPowerTelemetry.timeStamp.value.datadouble; + deltatimestamp = curtimestamp - prevtimestamp; + + if (pPowerTelemetry.gpuEnergyCounter.bSupported) + { + TelemetryData->gpuEnergySupported = true; + prevgpuEnergyCounter = curgpuEnergyCounter; + curgpuEnergyCounter = pPowerTelemetry.gpuEnergyCounter.value.datadouble; + + TelemetryData->gpuEnergyValue = (curgpuEnergyCounter - prevgpuEnergyCounter) / deltatimestamp; + } + + TelemetryData->gpuVoltageSupported = pPowerTelemetry.gpuVoltage.bSupported; + TelemetryData->gpuVoltagValue = pPowerTelemetry.gpuVoltage.value.datadouble; + + TelemetryData->gpuCurrentClockFrequencySupported = pPowerTelemetry.gpuCurrentClockFrequency.bSupported; + TelemetryData->gpuCurrentClockFrequencyValue = pPowerTelemetry.gpuCurrentClockFrequency.value.datadouble; + + TelemetryData->gpuCurrentTemperatureSupported = pPowerTelemetry.gpuCurrentTemperature.bSupported; + TelemetryData->gpuCurrentTemperatureValue = pPowerTelemetry.gpuCurrentTemperature.value.datadouble; + + if (pPowerTelemetry.globalActivityCounter.bSupported) + { + TelemetryData->globalActivitySupported = true; + prevglobalActivityCounter = curglobalActivityCounter; + curglobalActivityCounter = pPowerTelemetry.globalActivityCounter.value.datadouble; + + TelemetryData->globalActivityValue = 100 * (curglobalActivityCounter - prevglobalActivityCounter) / deltatimestamp; + } + + if (pPowerTelemetry.renderComputeActivityCounter.bSupported) + { + TelemetryData->renderComputeActivitySupported = true; + prevrenderComputeActivityCounter = currenderComputeActivityCounter; + currenderComputeActivityCounter = pPowerTelemetry.renderComputeActivityCounter.value.datadouble; + + TelemetryData->renderComputeActivityValue = 100 * (currenderComputeActivityCounter - prevrenderComputeActivityCounter) / deltatimestamp; + } + + if (pPowerTelemetry.mediaActivityCounter.bSupported) + { + TelemetryData->mediaActivitySupported = true; + prevmediaActivityCounter = curmediaActivityCounter; + curmediaActivityCounter = pPowerTelemetry.mediaActivityCounter.value.datadouble; + + TelemetryData->mediaActivityValue = 100 * (curmediaActivityCounter - prevmediaActivityCounter) / deltatimestamp; + } + + if (pPowerTelemetry.vramEnergyCounter.bSupported) + { + TelemetryData->vramEnergySupported = true; + prevvramEnergyCounter = curvramEnergyCounter; + curvramEnergyCounter = pPowerTelemetry.vramEnergyCounter.value.datadouble; + + TelemetryData->vramEnergyValue = (curvramEnergyCounter - prevvramEnergyCounter) / deltatimestamp; + } + + TelemetryData->vramVoltageSupported = pPowerTelemetry.vramVoltage.bSupported; + TelemetryData->vramVoltageValue = pPowerTelemetry.vramVoltage.value.datadouble; + + TelemetryData->vramCurrentClockFrequencySupported = pPowerTelemetry.vramCurrentClockFrequency.bSupported; + TelemetryData->vramCurrentClockFrequencyValue = pPowerTelemetry.vramCurrentClockFrequency.value.datadouble; + + if (pPowerTelemetry.vramReadBandwidthCounter.bSupported) + { + TelemetryData->vramReadBandwidthSupported = true; + prevvramReadBandwidthCounter = curvramReadBandwidthCounter; + curvramReadBandwidthCounter = pPowerTelemetry.vramReadBandwidthCounter.value.datadouble; + + TelemetryData->vramReadBandwidthValue = (curvramReadBandwidthCounter - prevvramReadBandwidthCounter) / deltatimestamp; + } + + if (pPowerTelemetry.vramWriteBandwidthCounter.bSupported) + { + TelemetryData->vramWriteBandwidthSupported = true; + prevvramWriteBandwidthCounter = curvramWriteBandwidthCounter; + curvramWriteBandwidthCounter = pPowerTelemetry.vramWriteBandwidthCounter.value.datadouble; + + TelemetryData->vramWriteBandwidthValue = (curvramWriteBandwidthCounter - prevvramWriteBandwidthCounter) / deltatimestamp; + } + + TelemetryData->vramCurrentTemperatureSupported = pPowerTelemetry.vramCurrentTemperature.bSupported; + TelemetryData->vramCurrentTemperatureValue = pPowerTelemetry.vramCurrentTemperature.value.datadouble; + + TelemetryData->fanSpeedSupported = pPowerTelemetry.fanSpeed[0].bSupported; + TelemetryData->fanSpeedValue = pPowerTelemetry.fanSpeed[0].value.datadouble; + + Exit: + return Result; + } + + ctl_result_t IntializeIgcl() + { + ctl_result_t Result = CTL_RESULT_SUCCESS; + + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + + ctl_init_args_t ctlInitArgs; + ctlInitArgs.AppVersion = CTL_MAKE_VERSION(CTL_IMPL_MAJOR_VERSION, CTL_IMPL_MINOR_VERSION); + ctlInitArgs.flags = CTL_INIT_FLAG_USE_LEVEL_ZERO; + ctlInitArgs.Size = sizeof(ctlInitArgs); + ctlInitArgs.Version = 0; + ZeroMemory(&ctlInitArgs.ApplicationUID, sizeof(ctl_application_id_t)); + Result = ctlInit(&ctlInitArgs, &hAPIHandle); + + return Result; + } + + void CloseIgcl() + { + ctlClose(hAPIHandle); + + if (hDevices != nullptr) + { + free(hDevices); + hDevices = nullptr; + } + } + +/*************************************************************** + * @brief + * SetCsc + * Iterate through blocks PixTxCaps and find the CSC block. + * @param hDisplayOutput, pPixTxCaps, CscBlockIndex + * @return ctl_result_t + ***************************************************************/ +ctl_result_t SetCsc(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_pipe_get_config_t *pPixTxCaps, int32_t CscBlockIndex) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_pixtx_block_config_t CSCConfig = pPixTxCaps->pBlockConfigs[CscBlockIndex]; + CSCConfig.Size = sizeof(ctl_pixtx_block_config_t); + CSCConfig.BlockType = CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX; + double PostOffsets[3] = { 1, 0, 0 }; + double PreOffsets[3] = { 1, 0, 0 }; + double Matrix[3][3] = { { 1.2, 0, 0 }, { 0, 1.2, 0 }, { 0, 0, 1.2 } }; // Contrast enhancement by 20% + + // Create a valid CSC Matrix. + for (uint8_t i = 0; i < 3; i++) + { + CSCConfig.Config.MatrixConfig.PreOffsets[i] = PreOffsets[i]; + } + + for (uint8_t i = 0; i < 3; i++) + { + CSCConfig.Config.MatrixConfig.PostOffsets[i] = PostOffsets[i]; + } + + memcpy_s(CSCConfig.Config.MatrixConfig.Matrix, sizeof(CSCConfig.Config.MatrixConfig.Matrix), Matrix, sizeof(Matrix)); + + ctl_pixtx_pipe_set_config_t SetPixTxArgs = { 0 }; + SetPixTxArgs.Size = sizeof(ctl_pixtx_pipe_set_config_t); + SetPixTxArgs.OpertaionType = CTL_PIXTX_CONFIG_OPERTAION_TYPE_SET_CUSTOM; + SetPixTxArgs.NumBlocks = 1; // We are trying to set only one block + SetPixTxArgs.pBlockConfigs = &CSCConfig; // for CSC block + SetPixTxArgs.pBlockConfigs->BlockId = pPixTxCaps->pBlockConfigs[CscBlockIndex].BlockId; + + Result = ctlPixelTransformationSetConfig(hDisplayOutput, &SetPixTxArgs); + LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "ctlPixelTransformationSetConfig"); + + return Result; +} + +/*************************************************************** + * @brief + * CIELabTxFn + * @param Input + * @return double + ***************************************************************/ +double CIELabTxFn(double Input) +{ + double RetVal = 0; + + /* + https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB + */ + + if (Input > pow(6.0 / 29.0, 3.0)) + { + RetVal = pow(Input, (1.0 / 3.0)); + } + else + { + RetVal = Input * (pow(29.0 / 6.0, 2.0) / 3.0) + (4.0 / 29.0); + } + + return RetVal; +} + +/*************************************************************** + * @brief + * GetCIELab + * @param Color, WhitePoint, ColorLab + * @return void + ***************************************************************/ +void GetCIELab(IPIXEL_XYZ Color, IPIXEL_XYZ WhitePoint, IPIXEL_Lab& ColorLab) +{ + /* + https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB + */ + + Color.X /= WhitePoint.X; + Color.Y /= WhitePoint.Y; + Color.Z /= WhitePoint.Z; + + ColorLab.L = 116.0 * (CIELabTxFn(Color.Y)) - 16; + ColorLab.A = 500.0 * (CIELabTxFn(Color.X) - CIELabTxFn(Color.Y)); + ColorLab.B = 200.0 * (CIELabTxFn(Color.Y) - CIELabTxFn(Color.Z)); +} + +/*************************************************************** + * @brief + * CalculateColorAngle + * @param R,G,B + * @return void + ***************************************************************/ +double CalculateColorAngle(double R, double G, double B) +{ + double RGB[3] = { 0 }; + IPIXEL_XYZ XYZ; + IPIXEL_Lab Lab; + + RGB[0] = GetSRGBDecodingValue(R); + RGB[1] = GetSRGBDecodingValue(G); + RGB[2] = GetSRGBDecodingValue(B); + + MatrixMult3x3With3x1(RGB2XYZ_709, RGB, (double*)&XYZ); + + XYZ.X *= 100.0; + XYZ.Y *= 100.0; + XYZ.Z *= 100.0; + + GetCIELab(XYZ, RefWhitePointSRGB, Lab); + + double Angle = atan2(Lab.B, Lab.A); // https://en.wikipedia.org/wiki/Hue + + // convert [-Pi, Pi] range to [0, 2 * Pi] range + if (Angle < 0) + { + Angle = 2.0 * Pi - (ABS_DOUBLE(Angle)); + } + + Angle /= (2.0 * Pi); + + return Angle; +} + +/*************************************************************** + * @brief + * InterpolateSaturationFactor + * @param ColorAngle, pBasicColors, pColorSaturation + * @return double + ***************************************************************/ +double InterpolateSaturationFactor(double ColorAngle, double* pBasicColors, double* pColorSaturation) +{ + double SatFactor = SATURATION_FACTOR_BASE; + double Slope, SatFactor1, SatFactor2, Diff; + + // ColorIndex1 represents index of anchor color previous to colorAngle + // ColorIndex2 represents index of anchor color next to colorAngle + HUE_ANCHOR ColorIndex1, ColorIndex2; + ColorIndex1 = (HUE_ANCHOR)((uint8_t)HUE_ANCHOR_COLOR_COUNT_SATURATION - 1); + + for (uint8_t i = 0; i < (uint8_t)HUE_ANCHOR_COLOR_COUNT_SATURATION; i++) + { + if (pBasicColors[i] <= ColorAngle) + { + ColorIndex1 = (HUE_ANCHOR)i; + } + } + + ColorIndex2 = (HUE_ANCHOR)((ColorIndex1 + 1) % HUE_ANCHOR_COLOR_COUNT_SATURATION); + + SatFactor1 = pColorSaturation[(uint8_t)ColorIndex1]; + SatFactor2 = pColorSaturation[(uint8_t)ColorIndex2]; + + if ((uint8_t)ColorIndex1 <= 4 || ColorAngle >= pBasicColors[(uint8_t)ColorIndex1]) + { + Diff = ColorAngle - pBasicColors[ColorIndex1]; + Slope = (SatFactor2 - SatFactor1) / (pBasicColors[ColorIndex2] - pBasicColors[ColorIndex1]); + } + else + { + Diff = ColorAngle - pBasicColors[ColorIndex1] + 1.0; + Slope = (SatFactor2 - SatFactor1) / (pBasicColors[ColorIndex2] - pBasicColors[ColorIndex1] + 1.0); + } + + SatFactor = SatFactor1 + Slope * Diff; + + return SatFactor; +} + +/*************************************************************** + * @brief + * PerformRGB2YCbCr: Conversion of RGB to YCbCr + * @param InPixel, OutPixel + * @return void + ***************************************************************/ +void PerformRGB2YCbCr(ctl_pixtx_3dlut_sample_t InPixel, IPIXELD_YCbCr& OutPixel) +{ + // Numbers used are BT 701 coefficients used for RGB to YCbCr conversion. + // https://en.wikipedia.org/wiki/YUV#Conversion_to/from_RGB + + OutPixel.Y = RGB2YCbCr709[0][0] * InPixel.Red + RGB2YCbCr709[0][1] * InPixel.Green + RGB2YCbCr709[0][2] * InPixel.Blue; + OutPixel.Cb = RGB2YCbCr709[1][0] * InPixel.Red + RGB2YCbCr709[1][1] * InPixel.Green + RGB2YCbCr709[1][2] * InPixel.Blue; + OutPixel.Cr = RGB2YCbCr709[2][0] * InPixel.Red + RGB2YCbCr709[2][1] * InPixel.Green + RGB2YCbCr709[2][2] * InPixel.Blue; +} + + +/*************************************************************** + * @brief + * PerformYCbCr2RGB: Conversion of YCbCr to RGB + * @param InPixel, OutPixel + * @return void + ***************************************************************/ +void PerformYCbCr2RGB(IPIXELD_YCbCr InPixel, ctl_pixtx_3dlut_sample_t& OutPixel) +{ + // BT 701 coefficients + // Numbers used are BT 701 coefficients used for YCbCr to RGB conversion. + // https://en.wikipedia.org/wiki/YUV#Conversion_to/from_RGB + + OutPixel.Red = InPixel.Y + YCbCr2RGB709[0][2] * InPixel.Cr; + OutPixel.Green = InPixel.Y + YCbCr2RGB709[1][1] * InPixel.Cb + YCbCr2RGB709[1][2] * InPixel.Cr; + OutPixel.Blue = InPixel.Y + YCbCr2RGB709[2][1] * InPixel.Cb; + + OutPixel.Red = CLIP_DOUBLE(OutPixel.Red, 0.0, 1.0); + OutPixel.Green = CLIP_DOUBLE(OutPixel.Green, 0.0, 1.0); + OutPixel.Blue = CLIP_DOUBLE(OutPixel.Blue, 0.0, 1.0); +} + +/*************************************************************** + * @brief + * ChangePixelSaturation + * @param PixelRGB, pBasicColors, pSatWeights + * @return void + ***************************************************************/ +void ChangePixelSaturation(ctl_pixtx_3dlut_sample_t& PixelRGB, double* pBasicColors, double* pSatWeights) +{ + double SatFactor = SATURATION_FACTOR_BASE; + double ColorAngle = 0; + IPIXELD_YCbCr PixelYCbCr; + + if ((PixelRGB.Red == PixelRGB.Green) && (PixelRGB.Green == PixelRGB.Blue)) + { + return; // Do not process Grey pixels + } + + PerformRGB2YCbCr(PixelRGB, PixelYCbCr); + + ColorAngle = CalculateColorAngle(PixelRGB.Red, PixelRGB.Green, PixelRGB.Blue); + + //--- Calculate Sat Factor (Step 1) --- + SatFactor = InterpolateSaturationFactor(ColorAngle, pBasicColors, pSatWeights); + + //--- Over Saturation Limiter (Step 2) --- + double UVmax = max((PixelYCbCr.Cb), ABS_DOUBLE(PixelYCbCr.Cr)); + UVmax *= 2.0; + + if ((UVmax >= UV_MAX_POINT) && (SatFactor > SATURATION_FACTOR_BASE)) + { + SatFactor = SATURATION_FACTOR_BASE; + } + else if (SatFactor > SATURATION_FACTOR_BASE) + { + // Limit SatFactor according to original saturation + double a = (SatFactor - SATURATION_FACTOR_BASE) * (UV_MAX_POINT - UVmax) / UV_MAX_POINT; + SatFactor = SATURATION_FACTOR_BASE + a; + } + + //--- Grey Pixels Saturation Limiter (Step 3) --- + if (SatFactor > SATURATION_FACTOR_BASE) + { + double dSat = SatFactor - SATURATION_FACTOR_BASE; + + if (UV_MIN_POINT1 >= UVmax) + { + dSat = 0; + } + else if (UV_MIN_POINT1 < UVmax && UVmax <= UV_MIN_POINT2) + { + dSat *= (UVmax - UV_MIN_POINT1); + } + + SatFactor = SATURATION_FACTOR_BASE + dSat; + } + + //--- Calculate New U,V values --- + PixelYCbCr.Cb = SatFactor * PixelYCbCr.Cb; + PixelYCbCr.Cr = SatFactor * PixelYCbCr.Cr; + + PerformYCbCr2RGB(PixelYCbCr, PixelRGB); + +} + +/*************************************************************** + * @brief + * CreateDefault3DLut + * @param pLUT, LutDepth, pSamplingPosition + * @return void + ***************************************************************/ +void CreateDefault3DLut(ctl_pixtx_3dlut_sample_t* pLUT, uint8_t LutDepth, double* pSamplingPosition) +{ + for (uint8_t R = 0; R < LutDepth; R++) + { + for (uint8_t G = 0; G < LutDepth; G++) + { + for (uint8_t B = 0; B < LutDepth; B++) + { + pLUT->Red = pSamplingPosition[R]; + pLUT->Green = pSamplingPosition[G]; + pLUT->Blue = pSamplingPosition[B]; + pLUT++; + } + } + } +} + + +/*************************************************************** + * @brief + * InitializePartialSaturationAnchorValues + * @param pBasicColors + * @return void + ***************************************************************/ +void InitializePartialSaturationAnchorValues(double* pBasicColors) +{ + pBasicColors[HUE_ANCHOR_RED_SATURATION] = 0.11111097848067050; // Output of CalculateColorAngle() with pure red input (1.0, 0, 0); + pBasicColors[HUE_ANCHOR_YELLOW_SATURATION] = 0.28571682845597457; // Output of CalculateColorAngle() with pure yellow input (1.0, 1.0, 0); + pBasicColors[HUE_ANCHOR_GREEN_SATURATION] = 0.37782403959790056; // Output of CalculateColorAngle() with pure green input (0, 1.0, 0); + pBasicColors[HUE_ANCHOR_CYAN_SATURATION] = 0.54552642779786065; // Output of CalculateColorAngle() with pure cyan input (0, 1.0, 1.0); + pBasicColors[HUE_ANCHOR_BLUE_SATURATION] = 0.85079006538296154; // Output of CalculateColorAngle() with pure blue input (0, 0, 1.0); + pBasicColors[HUE_ANCHOR_MAGENTA_SATURATION] = 0.91174274251260268; // Output of CalculateColorAngle() with pure magenta input (1.0, 0, 1.0); +} + + +/*************************************************************** + * @brief + * IsDefaultPartialSaturationSettings + * @param pSatWeights + * @return bool + ***************************************************************/ +bool IsDefaultPartialSaturationSettings(double* pSatWeights) +{ + for (uint8_t i = 0; i < 6; i++) + { + if (DEFAULT_COLOR_SAT != pSatWeights[i]) + { + return false; + } + } + + return true; +} + + +/*************************************************************** + * @brief + * Generate3DLutFromPSWeights + * @param pLUT, LutDepth, pSatWeights + * @return ctl_result_t + ***************************************************************/ +ctl_result_t Generate3DLutFromPSWeights(ctl_pixtx_3dlut_sample_t *pLUT, uint8_t LutDepth, double *pSatWeights) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + + ctl_pixtx_3dlut_sample_t Pix; + double BasicColors[HUE_ANCHOR_COLOR_COUNT_SATURATION]; + + bool IsDefaultConfig = IsDefaultPartialSaturationSettings(pSatWeights); + + InitializePartialSaturationAnchorValues(BasicColors); + + double *pSamplingPosition = (double *)malloc(LutDepth * sizeof(double)); + EXIT_ON_MEM_ALLOC_FAILURE(pSamplingPosition, "pSamplingPosition"); + + for (uint8_t i = 0; i < LutDepth; i++) + { + pSamplingPosition[i] = (double)i / (double)(LutDepth - 1); + } + + if (IsDefaultConfig) + { + CreateDefault3DLut(pLUT, LutDepth, pSamplingPosition); + goto Exit; + } + + for (uint8_t R = 0; R < LutDepth; R++) + { + for (uint8_t G = 0; G < LutDepth; G++) + { + for (uint8_t B = 0; B < LutDepth; B++) + { + Pix.Red = pSamplingPosition[R]; + Pix.Green = pSamplingPosition[G]; + Pix.Blue = pSamplingPosition[B]; + + ChangePixelSaturation(Pix, BasicColors, pSatWeights); + + *pLUT++ = Pix; + } + } + } + +Exit: + CTL_FREE_MEM(pSamplingPosition); + return Result; +} + + + +/*************************************************************** + * @brief + * Generate OneDLut From brightness, contrast, gamma values + * @param pOneDLutConfig, Contrast, PanelGamma, Brightness + * @return void + ***************************************************************/ +void CreateOneDLutFromBCG(ctl_pixtx_1dlut_config_t *pOneDLutConfig, IPIXELD Contrast, IPIXELD PanelGamma, IPIXELD Brightness) +{ + IPIXELD RelativeGamma; + double *pRedLut, *pGreenLut, *pBlueLut; + double NormalizedOutputR, NormalizedOutputG, NormalizedOutputB; + double NormalizedInput; + double NormalizedOutputContrastBrightnessGammaR, NormalizedOutputContrastBrightnessGammaG, NormalizedOutputContrastBrightnessGammaB; + + RelativeGamma.R = PanelGamma.R; + RelativeGamma.G = PanelGamma.G; + RelativeGamma.B = PanelGamma.B; + + // Adjust inputs such that output is somewhat visible + Contrast.R = CLIP_DOUBLE(Contrast.R, 0.25, 1.75); + Contrast.G = CLIP_DOUBLE(Contrast.G, 0.25, 1.75); + Contrast.B = CLIP_DOUBLE(Contrast.B, 0.25, 1.75); + + // Adjust inputs such that output is somewhat visible + RelativeGamma.R = CLIP_DOUBLE(RelativeGamma.R, 0.3, 2.8); + RelativeGamma.G = CLIP_DOUBLE(RelativeGamma.G, 0.3, 2.8); + RelativeGamma.B = CLIP_DOUBLE(RelativeGamma.B, 0.3, 2.8); + + // Adjust inputs such that output is somewhat visible + Brightness.R = CLIP_DOUBLE(Brightness.R, -0.25, 0.25); + Brightness.G = CLIP_DOUBLE(Brightness.G, -0.25, 0.25); + Brightness.B = CLIP_DOUBLE(Brightness.B, -0.25, 0.25); + + // Create 1DLUT from given input + pRedLut = pOneDLutConfig->pSampleValues; + pGreenLut = pRedLut + pOneDLutConfig->NumSamplesPerChannel; + pBlueLut = pGreenLut + pOneDLutConfig->NumSamplesPerChannel; + + for (uint32_t i = 0; i < pOneDLutConfig->NumSamplesPerChannel; i++) + { + NormalizedInput = (double)i / (double)(pOneDLutConfig->NumSamplesPerChannel - 1); + + NormalizedOutputR = ((NormalizedInput * Contrast.R) + Brightness.R); + NormalizedOutputG = ((NormalizedInput * Contrast.G) + Brightness.G); + NormalizedOutputB = ((NormalizedInput * Contrast.B) + Brightness.B); + + NormalizedOutputR = CLIP_DOUBLE(NormalizedOutputR, 0.0, 1.0); + NormalizedOutputG = CLIP_DOUBLE(NormalizedOutputG, 0.0, 1.0); + NormalizedOutputB = CLIP_DOUBLE(NormalizedOutputB, 0.0, 1.0); + + NormalizedOutputContrastBrightnessGammaR = pow(NormalizedOutputR, RelativeGamma.R); + NormalizedOutputContrastBrightnessGammaG = pow(NormalizedOutputG, RelativeGamma.G); + NormalizedOutputContrastBrightnessGammaB = pow(NormalizedOutputB, RelativeGamma.B); + + pRedLut[i] = NormalizedOutputContrastBrightnessGammaR; + pGreenLut[i] = NormalizedOutputContrastBrightnessGammaG; + pBlueLut[i] = NormalizedOutputContrastBrightnessGammaB; + } +} + + +/*************************************************************** + * @brief + * ApplyBrightnessContrastGamma + * @param hDisplayOutput, pBlockConfig, Contrast, Gamma, Brightness + * @return ctl_result_t + ***************************************************************/ +ctl_result_t ApplyBrightnessContrastGamma(ctl_display_output_handle_t hDisplayOutput, ctl_pixtx_block_config_t *pBlockConfig, IPIXELD Contrast, IPIXELD Gamma, IPIXELD Brightness) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_pixtx_block_config_t LutConfig = *pBlockConfig; + LutConfig.Size = sizeof(ctl_pixtx_block_config_t); + const uint32_t LutSize = LutConfig.Config.OneDLutConfig.NumSamplesPerChannel * LutConfig.Config.OneDLutConfig.NumChannels; + // this is the cause of the crash, NumChannels one channel only ! + LutConfig.Config.OneDLutConfig.pSampleValues = (double *)malloc(LutSize * sizeof(double)); + + ctl_pixtx_pipe_set_config_t SetPixTxArgs = { 0 }; + SetPixTxArgs.Size = sizeof(ctl_pixtx_pipe_set_config_t); + SetPixTxArgs.OpertaionType = CTL_PIXTX_CONFIG_OPERTAION_TYPE_SET_CUSTOM; + SetPixTxArgs.NumBlocks = 1; // We are enabling only one block + SetPixTxArgs.pBlockConfigs = &LutConfig; // for 1DLUT block + + EXIT_ON_MEM_ALLOC_FAILURE(LutConfig.Config.OneDLutConfig.pSampleValues, "LutConfig.Config.OneDLutConfig.pSampleValues"); + + + CreateOneDLutFromBCG(&LutConfig.Config.OneDLutConfig, Contrast, Gamma, Brightness); + + Result = ctlPixelTransformationSetConfig(hDisplayOutput, &SetPixTxArgs); + + LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationSetConfig"); + +Exit: + CTL_FREE_MEM(LutConfig.Config.OneDLutConfig.pSampleValues); + return Result; +} + +ctl_result_t SetBrightnessContrastGammaValues(ctl_device_adapter_handle_t hDevice, double contrast, double panelGamma, double brightness) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_display_output_handle_t *hDisplayOutput = NULL; + uint32_t DisplayCount = 0; + + + // enumerate all the possible target display's for the adapters + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, NULL); + + if (CTL_RESULT_SUCCESS != Result) + { + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); + STORE_AND_RESET_ERROR(Result); + } + else if (DisplayCount <= 0) + { + APP_LOG_WARN("Invalid Display Count. skipping display enumration for adapter:%d", 0); + } + + hDisplayOutput = (ctl_display_output_handle_t *)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + // Todo: use Display Index in future, currently only Apply Hue Saturation on Display 0; + ctl_display_output_handle_t display = hDisplayOutput[0]; + + // 1st query about the number of blocks supported (pass PixTxCaps.pBlockConfigs as NULL to get number of blocks supported) and then allocate memeory accordingly in second call to get details of + // each pBlockConfigs + ctl_pixtx_pipe_get_config_t PixTxCaps = { 0 }; + PixTxCaps.Size = sizeof(ctl_pixtx_pipe_get_config_t); + PixTxCaps.QueryType = CTL_PIXTX_CONFIG_QUERY_TYPE_CAPABILITY; + + Result = GetPixTxCapability(display, &PixTxCaps); // API call will return the number of blocks supported in PixTxCaps.NumBlocks. + + if (0 == PixTxCaps.NumBlocks) + { + Result = CTL_RESULT_ERROR_INVALID_SIZE; + LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationGetConfig for query type capability"); + } + + const uint8_t NumBlocksToQuery = PixTxCaps.NumBlocks; // Query about the blocks in the pipeline + + // Allocate required memory as per number of blocks supported. + PixTxCaps.pBlockConfigs = (ctl_pixtx_block_config_t*)malloc(NumBlocksToQuery * sizeof(ctl_pixtx_block_config_t)); + EXIT_ON_MEM_ALLOC_FAILURE(PixTxCaps.pBlockConfigs, "PixTxCaps.pBlockConfigs"); + + memset(PixTxCaps.pBlockConfigs, 0, NumBlocksToQuery * sizeof(ctl_pixtx_block_config_t)); + + // Query capability of each block, number of blocks etc + Result = GetPixTxCapability(display, &PixTxCaps); + + int32_t DesktopGammaBlockIndex = -1; + for (uint8_t i = 0; i < PixTxCaps.NumBlocks; i++) + { + // Need to consider the last 1DLUT block for Gamma + if (CTL_PIXTX_BLOCK_TYPE_1D_LUT == PixTxCaps.pBlockConfigs[i].BlockType) + { + // Make sure it's 3 Channels for the 1D LUT and it's not the Gamma LUT Block + if ((3 == PixTxCaps.pBlockConfigs[i].Config.OneDLutConfig.NumChannels)) + { + DesktopGammaBlockIndex = i; + break; + } + } + } + + if (DesktopGammaBlockIndex < 0) + { + APP_LOG_ERROR("ctlPixelTransformationGetConfig did not report 1DLUT capability"); + STORE_AND_RESET_ERROR(Result); + } + else + { + double brightness_mapped = (brightness - 50.0) / 50.0 * 0.25; + double contrast_mapped = 1.0 + ((contrast - 50.0) / 50.0) * 0.75; + + + + IPIXELD Contrast = { 0 }; + IPIXELD PanelGamma = { 0 }; + IPIXELD Brightness = { 0 }; + + Contrast.R = contrast_mapped; + Contrast.G = contrast_mapped; + Contrast.B = contrast_mapped; + + PanelGamma.R = panelGamma; + PanelGamma.G = panelGamma; + PanelGamma.B = panelGamma; + + Brightness.R = brightness_mapped; + Brightness.G = brightness_mapped; + Brightness.B = brightness_mapped; + + Result = ApplyBrightnessContrastGamma(display, &PixTxCaps.pBlockConfigs[DesktopGammaBlockIndex], Contrast, PanelGamma, Brightness); + LOG_AND_EXIT_ON_ERROR(Result, "ApplyBrightnessContrastGamma"); + + // log for debug + cout << "======== SetBrightnessContrastGammaValues ========" << endl; + cout << "Contrast: " << contrast_mapped << endl; + cout << "PanelGamma: " << panelGamma << endl; + cout << "Brightness: " << brightness_mapped << endl; + } + +Exit: + return Result; +} + +double MapSaturation(int sliderValue) { + return 0.01 + sliderValue * 0.02; +} + +double MapHue(double sliderValue) { + double driverHue = fmod(sliderValue + 360.0, 360.0); + if (driverHue < 0.0) // handle negative wrap (just in case) + driverHue += 360.0; + return driverHue; +} + +ctl_result_t SetHueSaturationValues(ctl_device_adapter_handle_t hDevice, double Hue, double Saturation) +{ + ctl_result_t Result = CTL_RESULT_SUCCESS; + ctl_display_output_handle_t* hDisplayOutput = NULL; + uint32_t DisplayCount = 0; + + + // enumerate all the possible target display's for the adapters + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, NULL); + + if (CTL_RESULT_SUCCESS != Result) + { + APP_LOG_WARN("ctlEnumerateDisplayOutputs returned failure code: 0x%X", Result); + STORE_AND_RESET_ERROR(Result); + } + else if (DisplayCount <= 0) + { + APP_LOG_WARN("Invalid Display Count. skipping display enumration for adapter:%d", 0); + } + + hDisplayOutput = (ctl_display_output_handle_t*)malloc(sizeof(ctl_display_output_handle_t) * DisplayCount); + EXIT_ON_MEM_ALLOC_FAILURE(hDisplayOutput, "hDisplayOutput"); + + Result = ctlEnumerateDisplayOutputs(hDevice, &DisplayCount, hDisplayOutput); + LOG_AND_STORE_RESET_RESULT_ON_ERROR(Result, "ctlEnumerateDisplayOutputs"); + + // Todo: use Display Index in future, currently only Apply Hue Saturation on Display 0; + ctl_display_output_handle_t display = hDisplayOutput[0]; + + // 1st query about the number of blocks supported (pass PixTxCaps.pBlockConfigs as NULL to get number of blocks supported) and then allocate memeory accordingly in second call to get details of + // each pBlockConfigs + ctl_pixtx_pipe_get_config_t PixTxCaps = { 0 }; + PixTxCaps.Size = sizeof(ctl_pixtx_pipe_get_config_t); + PixTxCaps.QueryType = CTL_PIXTX_CONFIG_QUERY_TYPE_CAPABILITY; + + Result = GetPixTxCapability(display, &PixTxCaps); // API call will return the number of blocks supported in PixTxCaps.NumBlocks. + + if (0 == PixTxCaps.NumBlocks) + { + Result = CTL_RESULT_ERROR_INVALID_SIZE; + LOG_AND_EXIT_ON_ERROR(Result, "ctlPixelTransformationGetConfig for query type capability"); + } + + const uint8_t NumBlocksToQuery = PixTxCaps.NumBlocks; // Query about the blocks in the pipeline + + // Allocate required memory as per number of blocks supported. + PixTxCaps.pBlockConfigs = (ctl_pixtx_block_config_t*)malloc(NumBlocksToQuery * sizeof(ctl_pixtx_block_config_t)); + EXIT_ON_MEM_ALLOC_FAILURE(PixTxCaps.pBlockConfigs, "PixTxCaps.pBlockConfigs"); + + memset(PixTxCaps.pBlockConfigs, 0, NumBlocksToQuery * sizeof(ctl_pixtx_block_config_t)); + + // Query capability of each block, number of blocks etc + Result = GetPixTxCapability(display, &PixTxCaps); + + // Apply Hue Saturation + int32_t HueSatBlockIndex = -1; + + for (uint8_t i = 0; i < PixTxCaps.NumBlocks; i++) + { + if (CTL_PIXTX_BLOCK_TYPE_3X3_MATRIX == PixTxCaps.pBlockConfigs[i].BlockType) + { + HueSatBlockIndex = i; + break; + } + } + + // issue the call + Result = ApplyHueSaturation(display, &PixTxCaps, HueSatBlockIndex, MapHue(Hue), MapSaturation(Saturation)); + LOG_AND_EXIT_ON_ERROR(Result, "ctl_result_t (ApplyHueSaturation)"); + + // log for debug + cout << "======== SetHueSaturationValues ========" << endl; + cout << "Hue: " << MapHue(Hue) << endl; + cout << "Saturation: " << MapSaturation(Saturation) << endl; + +Exit: + return Result; +} + +} \ No newline at end of file