Skip to content

BT.2020 HDR flag broken with 5700 XT and all Ryzen Radeon lineup.  #35

@fandangos2

Description

@fandangos2

Hi, it's been quite sometime since I opened an issue here.

I'm the developer of the HDR Edition of Kodi that uses private APIs to trigger HDR on and off based on the source primaries and the presence of HDR metadata on the video file.

Source code of my project is here:
https://github.com/fandangos/Kodi-HDR-Edition

Thread with 110k+ views here:
https://forum.kodi.tv/showthread.php?tid=345566

While my usage of AMD AGS works exactly as it should for the RX 550 it does not for all Ryzen iGPUs and RX 5700 dedicated GPUs.

This is my code to trigger HDR ON and OFF based on content and using the video file color coordinates:

`void CWinSystemWin32DX::SetHdrAMD(bool enableHDR,
double rx,
double ry,
double gx,
double gy,
double bx,
double by,
double wx,
double wy,
double minMaster,
double maxMaster,
double maxCLL,
double maxFALL)
{
DXGI_ADAPTER_DESC id = {};
DX::DeviceResources::Get()->GetAdapterDesc(&id);

if (id.VendorId == 0x1002)
{
if ((agsInit) && (agsDeInit) && (agsSetDisplayMode))
{
AGSContext* context = NULL;
AGSGPUInfo gpuInfo;
memset(&gpuInfo, 0, sizeof(gpuInfo));

  if (agsInit(&context, NULL, &gpuInfo) == AGS_SUCCESS)
  {
    for (int i1 = 0; i1 < gpuInfo.numDevices; i1++)
      for (int i2 = 0; i2 < gpuInfo.devices[i1].numDisplays; i2++)
        if (gpuInfo.devices[i1].displays[i2].displayDeviceName)
        {
          AGSDisplaySettings settings;
          ZeroMemory(&settings, sizeof(settings));
          settings.mode =
              enableHDR ? AGSDisplaySettings::Mode_HDR10_PQ : AGSDisplaySettings::Mode_SDR;
         if (enableHDR)
          {
            settings.chromaticityRedX = (rx);
            settings.chromaticityRedY = (ry);
            settings.chromaticityGreenX = (gx);
            settings.chromaticityGreenY = (gy);
            settings.chromaticityBlueX = (bx);
            settings.chromaticityBlueY = (by);
            settings.chromaticityWhitePointX = (wx);
            settings.chromaticityWhitePointY = (wy);
            settings.minLuminance = (minMaster);
            settings.maxLuminance = (maxMaster);
            settings.maxContentLightLevel = (maxCLL);
            settings.maxFrameAverageLightLevel = (maxFALL);
            settings.flags = 0;
          } 
          AGSReturnCode AmdStatus = agsSetDisplayMode(context, i1, i2, &settings);
        }
     agsDeInit(context);
  }
}

}
}
`
This is using DXGI_FORMAT_R10G10B10A2_UNORM as instructed.

The problem, as posted previewsly here by others is that the metadata, Red X and Y, Blue X and Y, Green X and Y, White X and Y, min Master, max Master, maxFALL and maxCLL are passed without modifications to the display.
Still several displays do not rely on BT.2020 RGBW coordinates to change it's color format but on a BT.2020 flag.

Using Windows HDR switch the BT.2020 flag is used but DX implementation of HDR is terrible forcing the user to guess if the movie has HDR metadata and switching the Windows toggle on.

Even using undocumented features to turn hdr on, based on registry sniffing this is still a bad solution because it will kill desired refresh rate change, for movies 23hz, and revert back to 60hz causing 3:2 pulldown.

Code with Windows 'hack' here:
https://github.com/fandangos/AutoHDR/blob/master/AUTOHDR_ON.cpp

So I was wondering if this could be fixed in the next driver update or if by any change the code I'm using has any problem that needs to be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions