cancel
Showing results for 
Search instead for 
Did you mean: 

GPU Developer Tools

terrymacdonald
Journeyman III

Issue using ADL ADL2_Display_SLSMapConfigX2_Get() and ADL2_Display_SLSMapConfig_Get()

Hi,

I'm the developer of DisplayMagician and I've been asked by my users to add AMD Eyefinity support to my software. I already have NVIDIA Surround support, so I thought it would be nice to add Eyefinity into the mix.

I have created a C# API using the ADL atiadlxx.dll and I'm testing that in a little test application I wrote called AMDInfo. 

I have successfully used all the ADL2 commands via my C# API, but I cannot get the ADL2_Display_SLSMapConfigX2_Get() or  ADL2_Display_SLSMapConfig_Get() functions to return successfully at all. Both of them ALWAYS return ADL_ERR. I have followed the documentation in the ADL to create the following P/Invoke signature:

[DllImport(ATI_ADL_DLL, CallingConvention = CallingConvention.Cdecl)]
public static extern ADL_STATUS ADL2_Display_SLSMapConfigX2_Get(IntPtr ADLContextHandle, int adapterIndex, int SLSMapIndex, out ADL_SLS_MAP SLSMap, out int NumSLSTarget, out IntPtr SLSTargetArray, out int lpNumNativeMode, out IntPtr NativeMode, out int NumNativeModeOffsets, out IntPtr NativeModeOffsets, out int NumBezelMode, out IntPtr BezelMode, out int NumTransientMode, out IntPtr TransientMode, out int NumSLSOffset, out IntPtr SLSOffset, int option);

This is exactly the same function signatures as the documentation shows here: https://gpuopen-librariesandsdks.github.io/adl/group__EYEFINITYAPI.html#ga1fcc230c1fb338c3e00d572c9a... 

This is an example of how I call the ADL2_Display_SLSMapConfigX2_Get function: 

int SLSMapIndex = -1;
ADL_STATUS ADLRet = ADLImport.ADL2_Display_SLSMapIndex_Get(_adlContextHandle, adapterIndex, numDisplayTargets, retrievedDisplayTargets, out SLSMapIndex);
if (ADLRet != ADL_STATUS.ADL_OK)
{
  logger.Error($"AMDLibrary/GetAMDDisplayConfig: ERROR - ADL2_Display_SLSMapIndex_Get returned ADL_STATUS {ADLRet} when trying to get the SLS Map Index from AMD adapter {adapterIndex} in the computer.");
}
int numSLSTargets = 0;
IntPtr SLSTargetBuffer = IntPtr.Zero;
int numNativeMode = 0;
IntPtr nativeModeBuffer = IntPtr.Zero;
int numNativeModeOffsets = 0;
IntPtr nativeModeOffsetsBuffer = IntPtr.Zero;
int numBezelMode = 0;
IntPtr bezelModeBuffer = IntPtr.Zero;
int numTransientMode = 0;
IntPtr TransientModeBuffer = IntPtr.Zero;
int numSLSOffset = 0;
IntPtr SLSOffsetBuffer = IntPtr.Zero;
ADL_SLS_MAP SLSMap = new ADL_SLS_MAP() ;
ADLRet = ADLImport.ADL2_Display_SLSMapConfigX2_Get( _adlContextHandle, adapterIndex, SLSMapIndex, out SLSMap, out numSLSTargets, out SLSTargetBuffer, out numNativeMode, out nativeModeBuffer, out numNativeModeOffsets, out nativeModeOffsetsBuffer, out numBezelMode, out bezelModeBuffer, out numTransientMode, out TransientModeBuffer, out numSLSOffset, out SLSOffsetBuffer, ADLImport.ADL_DISPLAY_SLSGRID_CAP_OPTION_RELATIVETO_CURRENTANGLE);
if (ADLRet == ADL_STATUS.ADL_OK)
{
  logger.Trace($"AMDLibrary/GetAMDDisplayConfig: ADL2_Display_SLSMapConfigX2_Get returned information about the SLS Info connected to AMD adapter {adapterIndex}.");
}
else
{
  logger.Error($"AMDLibrary/GetAMDDisplayConfig: ERROR - ADL2_Display_SLSMapConfigX2_Get returned ADL_STATUS {ADLRet} when trying to get the SLS Info from AMD adapter {adapterIndex} in the computer.");
  throw new AMDLibraryException($"ADL2_Display_DisplayMapConfig_Get returned ADL_STATUS {ADLRet} when trying to get the display target info from AMD adapter {adapterIndex} in the computer");
}

These two functions are the only ones I can't use, and yet are the most important for me to get working as they are critical to me determining whether Eyefinity (SLS) is enabled or not, and for storing the SLS settings.

Do you have any ideas for what I'm doing wrong?

  • I thought maybe there was no SLS Map set, but I can successfully get the SLS Map index using ADL2_Display_SLSMapIndex_Get(), and I can enable SLS or disable it with ADL2_Display_SLSMapConfig_SetState(), so I know there is one set. I can even see it using ADL2_Display_SLSMapIndexList_Get().
  • I thought maybe the docs were wrong and that the parameter mapping in the AMD ADL docs was different from the DLL exports, but I checked the DLL using GHidra, and the parameters all line up.
  • I tried nulling out some of the IN parameters but all that did was cause the function to return an ADL_ERR_NULL_POINTER error :(.

I'm out of ideas. 

Can you please confirm that the ADL2_Display_SLSMapConfigX2_Get() and ADL2_Display_SLSMapConfig_Get() functions are working for you? Is there anything else I can try to get this working? Can you see any error in how I'm using those functions?

I'm using AMD Radeon Software Adrenalin 21.5.2 as I'm testing with an AMD HD 7790 (it's the only AMD video card I have available), and the latest version of AMD Radeon Software Adrenalin unfortunately drops support for the HD7790 :(.

Please help. I really want to add AMD support, and this is the one thing that's stopping me. I may have to just not support AMD Eyefinity and that would make many of my users (and me) very sad indeed.

Thanks

Terry

0 Likes
4 Replies
dipak
Big Boss

Hi @terrymacdonald,

Thank you for the above queries. I'll forward it to the ADL team. I'll let you know once I get any feedback on this.

Also, I've whitelisted you for the AMD Developer community.

Thanks.

0 Likes

Hi @terrymacdonald ,

ADL2_Display_SLSMapConfigX2_Get() is used in the below example (available in the ADL SDK). Could you please try the sample to see if it works?

https://gpuopen-librariesandsdks.github.io/adl/Eyefinity-example.html

https://github.com/GPUOpen-LibrariesAndSDKs/display-library/tree/master/Sample/Eyefinity

 

Thanks.

0 Likes

Just replying to this for completeness and so anyone else who suffers this issue can find a workaround. It turns out the AMD ADL driver has a weird issue where it won't work for 'some' ADL commands unless you create an environment variable called 'ADL_4KWORKAROUND_CANCEL' and set to to 'TRUE'. I have to say this is such bad form by AMD. It's not mentioned anywhere in any ADL documentation, and I stumbled across it in one of the AMD samples:

`Environment.SetEnvironmentVariable("ADL_4KWORKAROUND_CANCEL", "TRUE");

Additionally, AMD doesn't supply a ADL2_Display_SLSMapConfig_GetState() function either, so there is no easy way to determine if Eyefinity is on or not. Instead you have to perform multiple different queries and tests in order to figure out whether SLS is enabled.

It really made me realise how much better the NVIDIA NvAPI is. NvAPI have a way to test if Mosaic/surround is enabled: https://docs.nvidia.com/gameworks/content/gameworkslibrary/coresdk/nvapi/structNV__MOSAIC__TOPO__BRI...

I couldn't find a similar feature in ADL. It's all a bit disappointing.

Regards
Terry
0 Likes

Thank you for the above feedback. I'll pass it on to the ADL team.

Thanks.

0 Likes