Sample for triggering HDR on AMD?
fandangos opened this issue · 3 comments
Hi, I have implemented HDR10 passthrough into kodi for Nvidia GPUs and now I would like to do the same for AMD.
But I'm really new to C++.
As of now this is the code I made so far:
agsInit;
AGSContext* HDRon = nullptr;
AGSDisplaySettings settings;
settings.mode = AGSDisplaySettings::Mode_HDR10_PQ;
settings.chromaticityRedX = static_cast<uint16_t>(av_q2d(picture.displayMetadata.display_primaries[0][0]));
settings.chromaticityRedY = static_cast<uint16_t>(av_q2d(picture.displayMetadata.display_primaries[0][1]));
settings.chromaticityGreenX = static_cast<uint16_t>(av_q2d(picture.displayMetadata.display_primaries[1][0]));
settings.chromaticityGreenY = static_cast<uint16_t>(av_q2d(picture.displayMetadata.display_primaries[1][1]));
settings.chromaticityBlueX = static_cast<uint16_t>(av_q2d(picture.displayMetadata.display_primaries[2][0]));
settings.chromaticityBlueY = static_cast<uint16_t>(av_q2d(picture.displayMetadata.display_primaries[2][1]));
settings.chromaticityWhitePointX = static_cast<uint16_t>(av_q2d(picture.displayMetadata.white_point[0]));
settings.chromaticityWhitePointY = static_cast<uint16_t>(av_q2d(picture.displayMetadata.white_point[1]));
settings.minLuminance = av_q2d(picture.displayMetadata.min_luminance);
settings.maxLuminance = av_q2d(picture.displayMetadata.max_luminance);
settings.maxContentLightLevel = picture.lightMetadata.MaxCLL;
settings.maxFrameAverageLightLevel = picture.lightMetadata.MaxFALL;
settings.flags = 0;
agsSetDisplayMode(HDRon, 0, 0, &settings);
This is added after this line
https://github.com/fandangos/xbmc/blob/master/xbmc/cores/VideoPlayer/VideoRenderers/windows/RendererBase.cpp#L206
So far I have no idea how to get DeviceIndex or DisplayIndex, so I'm setting it to zero.
Any chance for some help or a sample just triggering HDR?
Hi,
DeviceIndex refers to the index into the array of devices enumerated when initialising AGS. On a single GPU system 0 is fine to get you up and running but you should probably handle the case of multiple GPUs (adapters).
DisplayIndex refers to the index into the array of displays attached to that GPU. Again, this is enumerated upon initialisation of AGS. Note, these might not have a direct mapping to the displays listed in DXGI so you will need to match them up based on name.
Note that the AGS HDR path is fine, but you might want to consider using DXGI 1.6 to enable HDR as that would be IHV agnostic. Microsoft have code on github showing the use of this.
Note that the AGS HDR path is fine, but you might want to consider using DXGI 1.6 to enable HDR as that would be IHV agnostic. Microsoft have code on github showing the use of this.
This code does not work as it should. It would be great if any of you already solved this problem.
I believe this is now resolved. Please open a new ticket if this is not the case.