Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions Samples/python/3D/3D.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#<!--
# Copyright (c) 2021 - 2025 Advanced Micro Devices, Inc. All rights reserved.
#
#-------------------------------------------------------------------------------------------------
#-->

import ADLXPybind as ADLX

# Iterate display and display event:plug and unplug the display
def afmfDemo():
# Get ADLXHelp and ADLX initialization
adlxHelper = ADLX.ADLXHelper()
ret = adlxHelper.Initialize()

if ret == ADLX.ADLX_RESULT.ADLX_OK:
# Get system services
system = adlxHelper.GetSystemServices()

if system is not None:
# Get display services
displayService = system.GetDisplaysServices()
if displayService is not None:
count = displayService.GetNumberOfDisplays()
print("display count: {}".format(count))
disList = displayService.GetDisplays()
if disList is not None:
foundDisplay = False
for index, display in enumerate(disList):
if display is not None and not foundDisplay:
foundDisplay = True
gpu = display.GetGPU()
gpuName = gpu.name()
vendorId = gpu.vendorId()
print(f"gpu name: {gpuName} vendor id: {vendorId}")
threeDSettingsServices = system.Get3DSettingsServices()

# AntiLag
antiLag = threeDSettingsServices.GetAntiLag(gpu)
antiLagSupported = antiLag.IsSupported()
antiLagEnabled = antiLag.IsEnabled()
print(f"support antilag: {antiLagSupported}, enable antilag: {antiLagEnabled}")
# antiLag.SetEnabled(False)

# Chill
chill = threeDSettingsServices.GetChill(gpu)
chillSupported = chill.IsSupported()
chillEnabled = chill.IsEnabled()
minFPS = chill.GetMinFPS()
maxFPS = chill.GetMaxFPS()
print(f"support chill: {chillSupported}, enable chill: {chillEnabled} minFPS: {minFPS} maxFPS: {maxFPS}")
# if not chillEnabled:
# chill.SetEnabled(True)
# chill.SetMinFPS(30)
# chill.SetMaxFPS(60)

# Boost
boost = threeDSettingsServices.GetBoost(gpu)
boostSupported = boost.IsSupported()
boostEnabled = boost.IsEnabled()
boostResolution = boost.GetResolution() # Performance: 50, Quality: 84
# boost.SetEnabled(True)
print(f"support boost: {boostSupported}, enable boost: {boostEnabled} boost resolution: {boostResolution}")

# GPU Scaling
gpuScaling = displayService.GetGPUScaling(display)
gpuScalingSupported = gpuScaling.IsSupported()
gpuScalingEnabled = gpuScaling.IsEnabled()
print(f"support GPU scaling: {gpuScalingSupported}, enable GPU scaling: {gpuScalingEnabled}")
# gpuScaling.SetEnabled(True)

# Integer Scaling
integerScaling = displayService.GetIntegerScaling(display)
integerScalingSupported = integerScaling.IsSupported()
integerScalingEnabled = integerScaling.IsEnabled()
print(f"support integer scaling: {integerScalingSupported}, enable integer scaling: {integerScalingEnabled}")

# Scaling Mode
scalingMode = displayService.GetScalingMode(display)
scalingModeSupported = scalingMode.IsSupported()
scalingModeNow = scalingMode.GetMode()
print(f"support scaling mode: {scalingModeSupported}, scaling mode: {scalingModeNow}")

# Radeon Super Resolution
radeonSuperResolution = threeDSettingsServices.GetRadeonSuperResolution()
radeonSuperResolutionSupported = radeonSuperResolution.IsSupported()
radeonSuperResolutionEnabled = radeonSuperResolution.IsEnabled()
radeonSuperResolutionSharpness = radeonSuperResolution.GetSharpness()
print(f"support radeon super resolution: {radeonSuperResolutionSupported}, enabled: {radeonSuperResolutionEnabled}, sharpness: {radeonSuperResolutionSharpness}")
# radeonSuperResolution.SetEnabled(False)

# AMD Fluid Motion Frame
threeDSettingsServices1 = system.Get3DSettingsServices1()
amdFluidMotionFrame = threeDSettingsServices1.GetAMDFluidMotionFrame()
amdFluidMotionFrameSupported = amdFluidMotionFrame.IsSupported()
amdFluidMotionFrameEnabled = amdFluidMotionFrame.IsEnabled()
print(f"support AMD fluid motion frame: {amdFluidMotionFrameSupported}, enabled: {amdFluidMotionFrameEnabled}")
# amdFluidMotionFrame.SetEnabled(True)

# Terminate ADLX
ret = adlxHelper.Terminate()
print("ADLX Terminate ret is: {}".format(ret))

afmfDemo()
18 changes: 10 additions & 8 deletions Samples/python/ADLXPybind/ADLXPybind/ADLXPybind.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -118,11 +118,12 @@
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>python39.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>python311.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(TargetDir)$(ProjectName).pyd" "$(SolutionDir)..\DisplayEvents\$(ProjectName).pyd"
copy /Y "$(TargetDir)$(ProjectName).pyd" "$(SolutionDir)..\DisplayInfo\$(ProjectName).pyd"</Command>
copy /Y "$(TargetDir)$(ProjectName).pyd" "$(SolutionDir)..\DisplayInfo\$(ProjectName).pyd"
copy /Y "$(TargetDir)$(ProjectName).pyd" "$(SolutionDir)..\3D\$(ProjectName).pyd"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand Down Expand Up @@ -163,11 +164,12 @@ copy /Y "$(TargetDir)$(ProjectName).pyd" "$(SolutionDir)..\DisplayInfo\$(Project
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>python39.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>python311.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /Y "$(TargetDir)$(ProjectName).pyd" ""$(SolutionDir)..\DisplayEvents\$(ProjectName).pyd"
copy /Y "$(TargetDir)$(ProjectName).pyd" ""$(SolutionDir)..\DisplayInfo\$(ProjectName).pyd"</Command>
copy /Y "$(TargetDir)$(ProjectName).pyd" ""$(SolutionDir)..\DisplayInfo\$(ProjectName).pyd"
copy /Y "$(TargetDir)$(ProjectName).pyd" ""$(SolutionDir)..\3D\$(ProjectName).pyd"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
Loading