mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 18:08:40 +02:00
d3d12: Use HEVC RefPicSet order from frontend
It is correctly sorted in frontend since779edc0759("frontends/va: Correctly derive HEVC StCurrBefore, StCurrAfter and LtCurr") This fixes RefPicSetLtCurr order which was incorrectly sorted here. Cc: mesa-stable (cherry picked from commit7a8721e95c) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41269>
This commit is contained in:
parent
64f8339209
commit
342f9fb5da
3 changed files with 1 additions and 49 deletions
|
|
@ -4464,7 +4464,7 @@
|
|||
"description": "d3d12: Use HEVC RefPicSet order from frontend",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -95,11 +95,6 @@ int d3d12_video_decoder_fence_wait(struct pipe_video_codec *codec,
|
|||
// We need enough to so next item in pipeline doesn't ask for a fence value we lost
|
||||
const uint64_t D3D12_VIDEO_DEC_ASYNC_DEPTH = 36;
|
||||
|
||||
struct d3d12_video_decoder_reference_poc_entry {
|
||||
uint8_t refpicset_index;
|
||||
int32_t poc_value;
|
||||
};
|
||||
|
||||
struct d3d12_video_decoder
|
||||
{
|
||||
struct pipe_video_codec base;
|
||||
|
|
@ -202,8 +197,6 @@ struct d3d12_video_decoder
|
|||
|
||||
// Indicates if GPU commands have not been flushed and are pending.
|
||||
bool m_needsGPUFlush = false;
|
||||
|
||||
std::vector<d3d12_video_decoder_reference_poc_entry> m_ReferencesConversionStorage;
|
||||
};
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -334,44 +334,6 @@ d3d12_video_decoder_log_pic_params_hevc(DXVA_PicParams_HEVC *pPicParams)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
d3d12_video_decoder_sort_rps_lists_by_refpoc(struct d3d12_video_decoder *pD3D12Dec, DXVA_PicParams_HEVC* pDXVAStruct, pipe_h265_picture_desc *pPipeDesc)
|
||||
{
|
||||
// Sort the RPS lists in pDXVAStruct in order by pPipeDesc->PicOrderCntVal for DXVA expectations.
|
||||
// Both arrays have parallel indices
|
||||
|
||||
pD3D12Dec->m_ReferencesConversionStorage.clear();
|
||||
for (uint8_t i = 0; i < pPipeDesc->NumPocStCurrBefore; i++)
|
||||
pD3D12Dec->m_ReferencesConversionStorage.push_back({ pDXVAStruct->RefPicSetStCurrBefore[i], pPipeDesc->PicOrderCntVal[pDXVAStruct->RefPicSetStCurrBefore[i]] });
|
||||
|
||||
std::sort(std::begin(pD3D12Dec->m_ReferencesConversionStorage), std::end(pD3D12Dec->m_ReferencesConversionStorage),
|
||||
[](d3d12_video_decoder_reference_poc_entry entryI, d3d12_video_decoder_reference_poc_entry entryJ)
|
||||
{ return entryI.poc_value /*desc order*/ > entryJ.poc_value; });
|
||||
for (uint8_t i = 0; i < pPipeDesc->NumPocStCurrBefore; i++)
|
||||
pDXVAStruct->RefPicSetStCurrBefore[i] = pD3D12Dec->m_ReferencesConversionStorage[i].refpicset_index;
|
||||
|
||||
pD3D12Dec->m_ReferencesConversionStorage.clear();
|
||||
for (uint8_t i = 0; i < pPipeDesc->NumPocStCurrAfter; i++)
|
||||
pD3D12Dec->m_ReferencesConversionStorage.push_back({ pDXVAStruct->RefPicSetStCurrAfter[i], pPipeDesc->PicOrderCntVal[pDXVAStruct->RefPicSetStCurrAfter[i]] });
|
||||
|
||||
std::sort(std::begin(pD3D12Dec->m_ReferencesConversionStorage), std::end(pD3D12Dec->m_ReferencesConversionStorage),
|
||||
[](d3d12_video_decoder_reference_poc_entry entryI, d3d12_video_decoder_reference_poc_entry entryJ)
|
||||
{ return entryI.poc_value /*ascending order*/ < entryJ.poc_value; });
|
||||
for (uint8_t i = 0; i < pPipeDesc->NumPocStCurrAfter; i++)
|
||||
pDXVAStruct->RefPicSetStCurrAfter[i] = pD3D12Dec->m_ReferencesConversionStorage[i].refpicset_index;
|
||||
|
||||
pD3D12Dec->m_ReferencesConversionStorage.clear();
|
||||
for (uint8_t i = 0; i < pPipeDesc->NumPocLtCurr; i++)
|
||||
pD3D12Dec->m_ReferencesConversionStorage.push_back({ pDXVAStruct->RefPicSetLtCurr[i], pPipeDesc->PicOrderCntVal[pDXVAStruct->RefPicSetLtCurr[i]] });
|
||||
|
||||
// The ordering of RefPicSetLtCurr is unclear from the DXVA spec, might need to be changed
|
||||
std::sort(std::begin(pD3D12Dec->m_ReferencesConversionStorage), std::end(pD3D12Dec->m_ReferencesConversionStorage),
|
||||
[](d3d12_video_decoder_reference_poc_entry entryI, d3d12_video_decoder_reference_poc_entry entryJ)
|
||||
{ return entryI.poc_value /*ascending order*/ < entryJ.poc_value; });
|
||||
for (uint8_t i = 0; i < pPipeDesc->NumPocLtCurr; i++)
|
||||
pDXVAStruct->RefPicSetLtCurr[i] = pD3D12Dec->m_ReferencesConversionStorage[i].refpicset_index;
|
||||
}
|
||||
|
||||
DXVA_PicParams_HEVC
|
||||
d3d12_video_decoder_dxva_picparams_from_pipe_picparams_hevc(
|
||||
struct d3d12_video_decoder *pD3D12Dec,
|
||||
|
|
@ -500,9 +462,6 @@ d3d12_video_decoder_dxva_picparams_from_pipe_picparams_hevc(
|
|||
dxvaStructure.RefPicSetLtCurr[i] = (i < pPipeDesc->NumPocLtCurr) ? pPipeDesc->RefPicSetLtCurr[i] : DXVA_HEVC_INVALID_PICTURE_ENTRY_VALUE;
|
||||
}
|
||||
|
||||
// DXVA drivers expect these in POC order, VA/pipe sends them out of order.
|
||||
d3d12_video_decoder_sort_rps_lists_by_refpoc(pD3D12Dec, &dxvaStructure, pPipeDesc);
|
||||
|
||||
for (uint32_t refIdx = 0; refIdx < DXVA_RPS_COUNT; refIdx++) {
|
||||
if ((refIdx < pPipeDesc->NumPocStCurrBefore) && (pPipeDesc->RefPicSetStCurrBefore[refIdx] != DXVA_HEVC_INVALID_PICTURE_ENTRY_VALUE)) {
|
||||
debug_printf("pPipeDesc->RefPicSetStCurrBefore[%d]: %d (index into RefPicList) Refs[%d] pipe buffer ptr = %p - d3d12 resource %p POC: %d\n",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue