CapFrameX OSD with RTSS

Discussion in 'Rivatuner Statistics Server (RTSS) Forum' started by ZeroStrat, Nov 4, 2019.

  1. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    It would be interesting for many people. Of course, you would have to make it configurable, so that the impact on performance wouldn't interfere if you didn't want it to.
     
  2. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,208
    Likes Received:
    6,894
    No, sorry. Bad idea.
     
  3. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    @Unwinder Is there a proper way to get the LUID from the ADL or AGS? In case of a Nvidia card I think it's possible to get it from the NVAPI. I used to notice something like that.

    upload_2020-9-14_10-49-30.png
     
  4. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,208
    Likes Received:
    6,894
    You don't need dediated functionality in NVAPI/ADL to reconcile enumerated AMD/NVIDIA handles with LUIDS. The only thing you need to know is physical display device location (i.e. its' PCI bus, device and function number, it is available via both from NVAPI and ADL). Then you can use the location to map it to LUID. Implementation can be found in both MSI AB and RTSS SDKs (D3DKMTDeviceList.cpp/h).
     
    ZeroStrat likes this.

  5. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    Another question. I hope it's ok. ^^

    I' m using the following struct to get the fan speed from the ADL.
    Code:
      [StructLayout(LayoutKind.Sequential)]
      internal struct ADLFanSpeedValue {
        public int Size;
        public int SpeedType;
        public int FanSpeed;
        public int Flags;
      }
    Question: Does the Flags property tells me wether the ZeroFanMode is active or not? The context is overdrive version 7 for a Vega 56 Pulse.
     
  6. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,208
    Likes Received:
    6,894
    Nope, refer to adl_defines.h for proper interpretation of Flags field. It contatins the only bit showing if user defined (i.e. fixed manual) or automatic mode is currently in programmed.
     
  7. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    Last edited: Sep 26, 2020
  8. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    You answered me on Twitter a few day ago because of the power entries from the NVAPI. The only entry I can find in the NVAPIWrapper is GetCurrentAbsPower(DWORD dwGpu, DWORD* lpPower) and the relative one as well of course...

    I would like to grap all these values. Is that possible?
    [​IMG]

    Edit: Ok, it muste be included in.

    NV_GPU_POWER_MONITOR_POWER_CHANNEL_STATUS_V2 channels[NV_GPU_POWER_MONITOR_POWER_CHANNELS_MAX];
     
    Last edited: Sep 26, 2020
  9. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    I've defined the following structs within my C# code.
    Code:
    [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct NvGpuPowerStatus
        {
            public uint Version;
            public uint ChannelMask;
            public uint TotalGpuPowermW;
    
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
            public char[] Rsvd;
    
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
            public NvGpuPowerMonitorPowerChannelStatus[] Channels;
        }
    
        [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct NvGpuPowerMonitorPowerChannelStatus
        {
            public uint PwrAvgmW;
            public uint PwrMinmW;
            public uint PwrMaxmW;
            public uint CurrmA;
            public uint VoltuV;
            public ulong EnergymJ;
    
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
            public char[] Rsvd;
        }
    And Version
    Code:
       public static readonly uint GPU_POWER_MONITOR_STATUS_VER = (uint)
              Marshal.SizeOf(typeof(NvGpuPowerStatus)) | 0x10000;
    Delegate with the ID from the RTSS SDK.
    Code:
       GetDelegate(0xF40238EF, out NvAPI_GPU_PowerMonitorGetStatus);
    It doesn't work. All properties have default values.
     
  10. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,208
    Likes Received:
    6,894
    Those values are reported as independent channels inside the same structure (NV_GPU_POWER_MONITOR_GET_STATUS_V2) accessed by that function. I report just total GPU power, which is a sum of channels feeding it.
     

  11. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,208
    Likes Received:
    6,894
    Check your NVAPI structure size/version, compare it with plugin’s one. Mist likely version or size/alignment you’re using is different.
     
    Dan Longman and ZeroStrat like this.
  12. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    What is NvU8 actually byte or char?

    Edit: It just works. ^^

    NvU8 = uint8 = sbyte

    And I had to change the pack size to 1.

    Code:
     [StructLayout(LayoutKind.Sequential, Pack = 1)]
        internal struct NvGpuPowerMonitorPowerChannelStatus
        {
            public uint PwrAvgmW;
            public uint PwrMinmW;
            public uint PwrMaxmW;
            public uint CurrmA;
            public uint VoltuV;
            public ulong EnergymJ;
    
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
            public sbyte[] Rsvd;
        }
     
    Last edited: Sep 27, 2020
    SpajdrEX likes this.
  13. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    All these Rsvd arrays only have default values.

    upload_2020-9-28_15-17-45.png

    Is this normal? And how can I identify the entries? I think names/descriptions would be helpful.
     
    Last edited: Sep 28, 2020
  14. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    Or is it the other way around? You must set identifiers so the parameters can be resolved internally?

    Any tips?
     
  15. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,208
    Likes Received:
    6,894
    No, that's not normal. Zeroes there means that something is wrong in structure definition again. Check fields alignment and compare them with original C++ version. Names/description are not necessary, that's NV's original structure naming and layout. Channels are identified by pwrRail in NV_GPU_POWER_MONITOR_POWER_CHANNEL_INFO_V2.
     
    RodroG likes this.

  16. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    I get values for all properties except the "Rsvd" arrays.What are these "Rsvd" arrays for?

    Code:
    [StructLayout(LayoutKind.Sequential, Pack = 8)]
        internal struct NvGpuPowerStatus
        {
            public uint Version;
            public uint ChannelMask;
            public uint TotalGpuPowermW;
    
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.POWER_STATUS_RSVD_SIZE)]
            public byte[] Rsvd;
    
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.POWER_STATUS_CHANNEL_COUNT)]
            public NvGpuPowerMonitorPowerChannelStatus[] Channels;
        }
    
        [StructLayout(LayoutKind.Sequential, Pack = 1)]
        internal struct NvGpuPowerMonitorPowerChannelStatus
        {
            public uint PwrAvgmW;
            public uint PwrMinmW;
            public uint PwrMaxmW;
            public uint CurrmA;
            public uint VoltuV;
            public ulong EnergymJ;
    
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = NVAPI.POWER_STATUS_RSVD_SIZE)]
            public byte[] Rsvd;
        }
    I've tried byte, sbyte and char as for NvU8. Nothing works.
     
  17. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,208
    Likes Received:
    6,894
    Rsrvd fields are reserved for future to keep stucture size/alignment static when adding new fields to it.
     
    ZeroStrat likes this.
  18. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    Last edited: Oct 5, 2020
  19. ZeroStrat

    ZeroStrat Active Member

    Messages:
    74
    Likes Received:
    20
    GPU:
    GPU
    @Unwinder Apparently there is max. amount of lines, that RTSS can display with CX as a non primary client. Is there something we can do from our side? We took most of the code from the Shared Memory example (RTSS SDK) but I cannot find any code which could be responsible for that.
     
  20. Unwinder

    Unwinder Ancient Guru Staff Member

    Messages:
    17,208
    Likes Received:
    6,894
    Each client's maximum text slot size is limited. You cannot extend it. You can use available space in more optimal way, avoid using tags when it is not necessary and use tag variabbles on frequently used tags to save space.
     

Share This Page