- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In Intel media SDK samples6.0.0.36, when create a d3d9 surface, I should use a d3dallocator. It calls D3DFrameAllocator::AllocImpl(mfxFrameAllocRequest *request, mfxFrameAllocResponse *response) to fulfill this task.
Innerly, AllocImpl() callsIDirectXVideoAccelerationService::CreateSurface(
[in] UINT Width,
[in] UINT Height, [in] UINT BackBuffers,
[in] D3DFORMAT Format,
[in] D3DPOOL Pool,
[in] DWORD Usage,
[in] DWORD DxvaType,
[out] IDirect3DSurface9 **ppSurface,
[in, out] HANDLE *pSharedHandle)
to create d3d9 surfaces. use it like:
if (request->Type & MFX_MEMTYPE_EXTERNAL_FRAME) {
for (int i = 0; i < request->NumFrameSuggested; i++) {
hr = videoService->CreateSurface(request->Info.Width, request->Info.Height, 0, format,
D3DPOOL_DEFAULT, m_surfaceUsage, target, &dxMids.m_surface, &dxMids.m_handle);
if (FAILED(hr)) {
ReleaseResponse(response);
MSDK_SAFE_FREE(dxMids);
return MFX_ERR_MEMORY_ALLOC;
}
dxMidPtrs = &dxMids;
}
It pass a handle to the parameter pSharedHandle to get a handle out. But It didn't specify how to use this handle.
I searched MSDN, it says:
- pSharedHandle [in, out]
A pointer to a handle that is used to share the surfaces between Direct3D devices. Set this parameter to NULL.
Then I searched another sample Interoperability with Intel® Media SDK. It use this pSharedHandle as the input of clCreateFromDX9MediasurfaceKHR aims to create a memory object shared by opencl and d3d9. Besides of this, I havn't seen a sample shows how to use this pSharedHandle.
In my application, I need a method with which I can share surfaces between different devices. It seems that this pSharedHandle give by CreateSurface could make a contribution. But I don't know how.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello there,
Apologies in delay on response. So, let first start with updating to latest MSDK and samples. Latest MSDK ver. 6.0.0.49 and samples ver. 6.0.0.68. Now in regard to pSharedHandle parameter is used in Direct3d9 to share between resources (devices and processes). In this case resource included the render target surface also. pSharedHandle is a HANDLE that points to shared resource and to open or access any previously created shared resources you just have to set pSharedHandle to the address of that previous handle. There is a blog on MSDN with explains APIs which include this handle and how handle can be used to share surfaces between different devices: https://msdn.microsoft.com/en-us/library/windows/desktop/bb219800 . Please take a look at Sharing Resources section. Hope this is the information you are looking for!
Thanks,
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page