We already check filter->num_surfaces above.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 771e90050da..652705e8430 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -434,11 +434,6 @@ static HRESULT VMR9_maybe_init(struct quartz_vmr *filter, BOOL force, const AM_M info.szNativeSize.cy = filter->bmiheader.biHeight;
filter->cur_surface = 0; - if (filter->num_surfaces) - { - ERR("num_surfaces or d3d9_surfaces not 0\n"); - return E_FAIL; - }
if (!is_vmr9(filter)) {
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 652705e8430..888f9e17510 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2124,7 +2124,7 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa return VFW_E_WRONG_STATE; }
- if (allocinfo->dwFlags & VMR9AllocFlag_OffscreenSurface) + if (allocinfo->dwFlags == VMR9AllocFlag_OffscreenSurface) { ERR("Creating offscreen surface\n"); for (i = 0; i < *numbuffers; ++i) @@ -2135,7 +2135,7 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa break; } } - else if (allocinfo->dwFlags & VMR9AllocFlag_TextureSurface) + else if (allocinfo->dwFlags == VMR9AllocFlag_TextureSurface) { TRACE("Creating texture surface\n"); for (i = 0; i < *numbuffers; ++i) @@ -2150,10 +2150,20 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa IDirect3DTexture9_Release(texture); } } + else if (allocinfo->dwFlags == VMR9AllocFlag_3DRenderTarget) + { + for (i = 0; i < *numbuffers; ++i) + { + if (FAILED(hr = IDirect3DDevice9_CreateRenderTarget(This->allocator_d3d9_dev, + allocinfo->dwWidth, allocinfo->dwHeight, allocinfo->Format, + D3DMULTISAMPLE_NONE, 0, FALSE, &surface[i], NULL))) + break; + } + } else { - FIXME("Could not allocate for type %08x\n", allocinfo->dwFlags); - return E_NOTIMPL; + FIXME("Unhandled flags %#x.\n", allocinfo->dwFlags); + return E_NOTIMPL; }
if (i >= allocinfo->MinBuffers)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/vmr9.c | 22 ++++++++++++++++++++++ dlls/quartz/vmr9.c | 12 ++++++++++++ 2 files changed, 34 insertions(+)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index e01e9ad5572..dc9aeec834c 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -2731,6 +2731,28 @@ static void test_allocate_surface_helper(void) ok(!surfaces[0], "Surface 0 was allocated.\n"); ok(!surfaces[1], "Surface 1 was allocated.\n");
+ info.Format = 0; + info.dwFlags = VMR9AllocFlag_3DRenderTarget; + count = 1; + hr = IVMRSurfaceAllocatorNotify9_AllocateSurfaceHelper(notify, &info, &count, surfaces); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + ok(!!surfaces[0], "Surface 0 was not allocated.\n"); + ok(info.Format != 0, "Expected a format.\n"); + + hr = IDirect3DSurface9_GetDesc(surfaces[0], &desc); + ok(hr == D3D_OK, "Got hr %#x.\n", hr); + ok(desc.Format == info.Format, "Expected format %#x, got %#x.\n", info.Format, desc.Format); + ok(desc.Type == D3DRTYPE_SURFACE, "Got type %u.\n", desc.Type); + ok(desc.Usage == D3DUSAGE_RENDERTARGET, "Got usage %#x.\n", desc.Usage); + ok(desc.Pool == D3DPOOL_DEFAULT, "Got pool %u.\n", desc.Pool); + ok(desc.MultiSampleType == D3DMULTISAMPLE_NONE, "Got multisample type %u.\n", desc.MultiSampleType); + ok(!desc.MultiSampleQuality, "Got multisample quality %u.\n", desc.MultiSampleQuality); + ok(desc.Width == 32, "Got width %u.\n", desc.Width); + ok(desc.Height == 16, "Got height %u.\n", desc.Height); + + IDirect3DSurface9_Release(surfaces[0]); + out: IVMRSurfaceAllocatorNotify9_Release(notify); ref = IBaseFilter_Release(filter); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 888f9e17510..f4faf2f97a8 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2112,6 +2112,18 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa if (!allocinfo || !numbuffers || !surface) return E_POINTER;
+ if (!allocinfo->Format) + { + IDirect3DSurface9 *backbuffer; + D3DSURFACE_DESC desc; + + IDirect3DDevice9_GetBackBuffer(This->allocator_d3d9_dev, 0, 0, + D3DBACKBUFFER_TYPE_MONO, &backbuffer); + IDirect3DSurface9_GetDesc(backbuffer, &desc); + IDirect3DSurface9_Release(backbuffer); + allocinfo->Format = desc.Format; + } + if (!*numbuffers || *numbuffers < allocinfo->MinBuffers) { ERR("Invalid number of buffers?\n");
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=70889
Your paranoid android.
=== w1064v1809 (32 bit report) ===
quartz: vmr9.c:2134: Test failed: Got unexpected status 0. vmr9.c:2137: Test failed: Wait timed out. vmr9.c:2145: Test failed: Got unexpected status 0x400040.
On 4/29/20 8:51 PM, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=70889
Your paranoid android.
=== w1064v1809 (32 bit report) ===
quartz: vmr9.c:2134: Test failed: Got unexpected status 0. vmr9.c:2137: Test failed: Wait timed out. vmr9.c:2145: Test failed: Got unexpected status 0x400040.
This seems to be an unrelated failure. Looks like I need to increase more timeouts...
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index f4faf2f97a8..f611a3a7cf0 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2107,11 +2107,15 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa DWORD i; HRESULT hr = S_OK;
- FIXME("(%p/%p)->(%p, %p => %u, %p) semi-stub\n", iface, This, allocinfo, numbuffers, (numbuffers ? *numbuffers : 0), surface); + TRACE("filter %p, allocinfo %p, numbuffers %p, surface %p.\n", This, numbuffers, allocinfo, surface);
if (!allocinfo || !numbuffers || !surface) return E_POINTER;
+ TRACE("Flags %#x, size %ux%u, format %u (%#x), pool %u, minimum buffers %u.\n", + allocinfo->dwFlags, allocinfo->dwWidth, allocinfo->dwHeight, + allocinfo->Format, allocinfo->Format, allocinfo->Pool, allocinfo->MinBuffers); + if (!allocinfo->Format) { IDirect3DSurface9 *backbuffer; @@ -2126,19 +2130,19 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa
if (!*numbuffers || *numbuffers < allocinfo->MinBuffers) { - ERR("Invalid number of buffers?\n"); + WARN("%u surfaces requested (minimum %u); returning E_INVALIDARG.\n", + *numbuffers, allocinfo->MinBuffers); return E_INVALIDARG; }
if (!This->allocator_d3d9_dev) { - ERR("No direct3d device when requested to allocate a surface!\n"); + WARN("No Direct3D device; returning VFW_E_WRONG_STATE.\n"); return VFW_E_WRONG_STATE; }
if (allocinfo->dwFlags == VMR9AllocFlag_OffscreenSurface) { - ERR("Creating offscreen surface\n"); for (i = 0; i < *numbuffers; ++i) { hr = IDirect3DDevice9_CreateOffscreenPlainSurface(This->allocator_d3d9_dev, allocinfo->dwWidth, allocinfo->dwHeight, @@ -2149,7 +2153,6 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa } else if (allocinfo->dwFlags == VMR9AllocFlag_TextureSurface) { - TRACE("Creating texture surface\n"); for (i = 0; i < *numbuffers; ++i) { IDirect3DTexture9 *texture; @@ -2178,6 +2181,9 @@ static HRESULT WINAPI VMR9SurfaceAllocatorNotify_AllocateSurfaceHelper(IVMRSurfa return E_NOTIMPL; }
+ if (FAILED(hr)) + WARN("%u/%u surfaces allocated, hr %#x.\n", i, *numbuffers, hr); + if (i >= allocinfo->MinBuffers) { hr = S_OK;