Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vp9e: do not allocate internal resources via external allocator #762

Closed
dvrogozh opened this issue Oct 16, 2018 · 7 comments
Closed

vp9e: do not allocate internal resources via external allocator #762

dvrogozh opened this issue Oct 16, 2018 · 7 comments
Labels
P1

Comments

@dvrogozh
Copy link
Contributor

@dvrogozh dvrogozh commented Oct 16, 2018

Please, switch vp9 encoder to use internal mediasdk core and avoid any external allocations for internal resources.

@dvrogozh dvrogozh added the P1 label Oct 16, 2018
DmitryMalishev added a commit to DmitryMalishev/MediaSDK that referenced this issue Nov 13, 2018
DmitryMalishev added a commit to DmitryMalishev/MediaSDK that referenced this issue Nov 20, 2018
DmitryMalishev added a commit to DmitryMalishev/MediaSDK that referenced this issue Nov 22, 2018
DmitryMalishev added a commit to DmitryMalishev/MediaSDK that referenced this issue Dec 13, 2018
DmitryMalishev added a commit to DmitryMalishev/MediaSDK that referenced this issue Dec 13, 2018
@onabiull onabiull closed this in 429b045 Dec 13, 2018
fzhar added a commit to fzhar/MediaSDK that referenced this issue Dec 26, 2018
jonrecker added a commit to jonrecker/MediaSDK that referenced this issue Feb 19, 2019
jonrecker added a commit to jonrecker/MediaSDK that referenced this issue Feb 19, 2019
@xhaihao

This comment has been minimized.

Copy link
Contributor

@xhaihao xhaihao commented Apr 29, 2019

@dvrogozh @onabiull @DmitryMalishev is D3DDDIFMT_INTELENCODE_MBSEGMENTMAP (MFX_FOURCC_VP9_SEGMAP) an internal resource ? According to

if (m_bSetExtFrameAlloc && request->Info.FourCC != MFX_FOURCC_P8)
, MediaSDK still tries to use the external frame allocator for D3DDDIFMT_INTELENCODE_MBSEGMENTMAP on linux

@DmitryMalishev

This comment has been minimized.

Copy link
Contributor

@DmitryMalishev DmitryMalishev commented May 13, 2019

Hi @xhaihao,
MFX_FOURCC_VP9_SEGMAP surface has MFX_MEMTYPE_INTERNAL_FRAME flag when inited:

request.Type = MFX_MEMTYPE_D3D_INT;

MFX_MEMTYPE_D3D_INT = MFX_MEMTYPE_FROM_ENCODE | MFX_MEMTYPE_DXVA2_DECODER_TARGET | MFX_MEMTYPE_INTERNAL_FRAME,

It means that internal frame allocator should be used for this surface allocation:
if (m_bSetExtFrameAlloc && request->Info.FourCC != MFX_FOURCC_P8)
{
// Default allocator should be used if D3D manager is not set and internal D3D buffers are required
if (!m_Display && request->Type & MFX_MEMTYPE_INTERNAL_FRAME)

Do you see in debug that it is not the case? Please let us know if so.

@eshiryae, could you please track this request if more help required?

@xhaihao

This comment has been minimized.

Copy link
Contributor

@xhaihao xhaihao commented May 14, 2019

@DmitryMalishev @eshiryae No, it is not the case because m_Display is not NULL.

Maybe MFX_FOURCC_VP9_SEGMAP should go into the else block too.

else
{
// Default Allocator is used for internal memory allocation and all coded buffers allocation
if (request->Type & MFX_MEMTYPE_EXTERNAL_FRAME)
return MFX_ERR_MEMORY_ALLOC;
m_bUseExtAllocForHWFrames = false;
sts = DefaultAllocFrames(request, response);
MFX_CHECK_STS(sts);
return TraceFrames(request, response, sts);
}

@DmitryMalishev

This comment has been minimized.

Copy link
Contributor

@DmitryMalishev DmitryMalishev commented May 14, 2019

@xhaihao, thank you for the clarification.
Before solving it out we(@eshiryae) would like to ask you a couple of things:
[1] What is the impacted usage scenario? Do you have workaround?
[2] Is it urgent change request?
[3] Is it possible to make it work by returning an UNSUPPORTED status from the external allocator on this request to make it use the internal allocator then?

sts = (*m_FrameAllocator.frameAllocator.Alloc)(m_FrameAllocator.frameAllocator.pthis, &temp_request, response);
// if external allocator cannot allocate d3d frames - use default memory allocator
if (MFX_ERR_UNSUPPORTED == sts || MFX_ERR_MEMORY_ALLOC == sts)
{
// Default Allocator is used for internal memory allocation only

@xhaihao

This comment has been minimized.

Copy link
Contributor

@xhaihao xhaihao commented May 15, 2019

@DmitryMalishev we are enabling vp9 encode in both ffmpeg/qsv and gst-msdk which have an external allocator. We may workaround it by returning an UNSUPPORTED status however we have to provide the workaround in both ffmpeg/qsv and gst-msdk, another thing is we failed to find MFX_FOURCC_VP9_SEGMAP in mfx header files, so we have to define it in ffmpeg/qsv and gst-msdk. Hence I think it would be better to fix it in MediaSDK.

lizhong1008 added a commit to lizhong1008/ffmpeg-1 that referenced this issue May 15, 2019
1. must enable low_power mode since just VDENC can be supported by iHD
driver right now
2. Coding option1 and extra_data are not supported by MSDK
3. IVF header will be inserted in MSDK by default, but it is not needed
in FFmpeg level, so disable it.
4. Internal buffer MFX_FOURCC_VP9_SEGMAP should not exposed to FFmpeg,
see Intel-Media-SDK/MediaSDK#762

Signed-off-by: Zhong Li <zhong.li@intel.com>
@eshiryae

This comment has been minimized.

Copy link
Contributor

@eshiryae eshiryae commented May 16, 2019

Hi @xhaihao, thank you for the details, we understand the problem and will work to solve it.

@eshiryae

This comment has been minimized.

Copy link
Contributor

@eshiryae eshiryae commented Jun 5, 2019

Hi @xhaihao, it is expected behavior for hw library and in this case you should return an unsupported error(MFX_ERR_UNSUPPORTED) for segmentation map allocation try. All resources which unsupported by external allocator are allocated by internal allocator.
According MFX_FOURCC_VP9_SEGMAP, you can define it as it's done here:

MFX_FOURCC_VP9_SEGMAP = MFX_MAKEFOURCC('V','P','8','S'),

fdo-mirror pushed a commit to freedesktop/gstreamer-gst-plugins-bad that referenced this issue Jul 7, 2019
MFX_FOURCC_VP9_SEGMAP surface in MSDK is an internal surface however
MSDK still call the external allocator for this surface, so this plugin
has to return UNSUPPORTED and force MSDK allocates surface using the
internal allocator.

See Intel-Media-SDK/MediaSDK#762 for details
lizhong1008 added a commit to lizhong1008/ffmpeg-1 that referenced this issue Sep 29, 2019
Return MFX_ERR_UNSUPPORTED for MFX_FOURCC_VP9_SEGMAP to force internal allocator.
See Intel-Media-SDK/MediaSDK#762 for more detail

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.