[PATCH v3 0/11] MR9520: VMR7 fixes
For Resident Evil 2 Classic. These are relatively small and simple patches, but I can certainly cut at 5 or so for a first MR. -- v3: quartz/tests: Add some VMR7 tests for unsupported formats. quartz/tests: Test VMR7 AllocateSurface with a BITMAPV4HEADER. quartz/tests: Test allocating BI_BITFIELDS pixel format. quartz/tests: Test allocating a surface with different bit depth from the primary. quartz/vmr7: Validate BITMAPINFOHEADER size. quartz/vmr7: Create a ddraw object if necessary to check for FourCC support. quartz/vmr7: Reject unsupported FOURCC formats. quartz/vmr7: Implement IVMRSurfaceAllocatorNotify::SetDDrawDevice(). https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Henri Verbeet <hverbeet(a)locutus.nl> --- dlls/quartz/vmr7.c | 2 +- dlls/quartz/vmr7_presenter.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/quartz/vmr7.c b/dlls/quartz/vmr7.c index 83f8b1d62d3..4263e79d54f 100644 --- a/dlls/quartz/vmr7.c +++ b/dlls/quartz/vmr7.c @@ -255,7 +255,7 @@ static HRESULT vmr_render(struct strmbase_renderer *iface, IMediaSample *sample) copy_plane(&dst, surface_desc.lPitch / 2, surface_desc.dwHeight / 2, &src, src_pitch / 2, height / 2); copy_plane(&dst, surface_desc.lPitch / 2, surface_desc.dwHeight / 2, &src, src_pitch / 2, height / 2); } - else if (height > 0 && bitmap_header->biCompression == BI_RGB) + else if (height > 0 && (bitmap_header->biCompression == BI_RGB || bitmap_header->biCompression == BI_BITFIELDS)) { BYTE *dst = surface_desc.lpSurface; const BYTE *src = data; diff --git a/dlls/quartz/vmr7_presenter.c b/dlls/quartz/vmr7_presenter.c index c244c86236a..90a0b906610 100644 --- a/dlls/quartz/vmr7_presenter.c +++ b/dlls/quartz/vmr7_presenter.c @@ -201,6 +201,16 @@ static HRESULT WINAPI surface_allocator_AllocateSurface(IVMRSurfaceAllocator *if surface_desc.ddpfPixelFormat.dwGBitMask = 0x0000ff00; surface_desc.ddpfPixelFormat.dwBBitMask = 0x000000ff; } + else if (info->lpHdr->biCompression == BI_BITFIELDS) + { + const DWORD *mask = (DWORD *)((BITMAPINFO *)info->lpHdr)->bmiColors; + + surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; + surface_desc.ddpfPixelFormat.dwRGBBitCount = info->lpHdr->biBitCount; + surface_desc.ddpfPixelFormat.dwRBitMask = mask[0]; + surface_desc.ddpfPixelFormat.dwGBitMask = mask[1]; + surface_desc.ddpfPixelFormat.dwBBitMask = mask[2]; + } else { surface_desc.ddpfPixelFormat.dwFlags = DDPF_FOURCC; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Henri Verbeet <hverbeet(a)locutus.nl> --- dlls/quartz/vmr7_presenter.c | 51 ++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/dlls/quartz/vmr7_presenter.c b/dlls/quartz/vmr7_presenter.c index 90a0b906610..1abee7b957d 100644 --- a/dlls/quartz/vmr7_presenter.c +++ b/dlls/quartz/vmr7_presenter.c @@ -187,29 +187,40 @@ static HRESULT WINAPI surface_allocator_AllocateSurface(IVMRSurfaceAllocator *if surface_desc.ddsCaps.dwCaps = DDSCAPS_FLIP | DDSCAPS_COMPLEX | DDSCAPS_OFFSCREENPLAIN; surface_desc.dwBackBufferCount = *count; - if (info->lpHdr->biCompression == BI_RGB) + if (info->lpHdr->biCompression == BI_RGB || info->lpHdr->biCompression == BI_BITFIELDS) { - if (info->lpHdr->biBitCount != 32) - { - FIXME("Unhandled bit depth %u.\n", info->lpHdr->biBitCount); - return E_NOTIMPL; - } + DDSURFACEDESC2 primary_desc; + DWORD *mask; - surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; - surface_desc.ddpfPixelFormat.dwRGBBitCount = 32; - surface_desc.ddpfPixelFormat.dwRBitMask = 0x00ff0000; - surface_desc.ddpfPixelFormat.dwGBitMask = 0x0000ff00; - surface_desc.ddpfPixelFormat.dwBBitMask = 0x000000ff; - } - else if (info->lpHdr->biCompression == BI_BITFIELDS) - { - const DWORD *mask = (DWORD *)((BITMAPINFO *)info->lpHdr)->bmiColors; + primary_desc.dwSize = sizeof(primary_desc); + if (FAILED(hr = IDirectDrawSurface7_GetSurfaceDesc(presenter->primary, &primary_desc))) + return hr; + if (info->lpHdr->biBitCount != primary_desc.ddpfPixelFormat.dwRGBBitCount) + return E_FAIL; - surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; - surface_desc.ddpfPixelFormat.dwRGBBitCount = info->lpHdr->biBitCount; - surface_desc.ddpfPixelFormat.dwRBitMask = mask[0]; - surface_desc.ddpfPixelFormat.dwGBitMask = mask[1]; - surface_desc.ddpfPixelFormat.dwBBitMask = mask[2]; + if (info->lpHdr->biCompression == BI_RGB) + { + if (info->lpHdr->biBitCount != 32) + { + FIXME("Unhandled bit depth %u.\n", info->lpHdr->biBitCount); + return E_NOTIMPL; + } + + surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; + surface_desc.ddpfPixelFormat.dwRGBBitCount = 32; + surface_desc.ddpfPixelFormat.dwRBitMask = 0x00ff0000; + surface_desc.ddpfPixelFormat.dwGBitMask = 0x0000ff00; + surface_desc.ddpfPixelFormat.dwBBitMask = 0x000000ff; + } + else + { + mask = (DWORD *)((BITMAPINFO *)info->lpHdr)->bmiColors; + surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; + surface_desc.ddpfPixelFormat.dwRGBBitCount = info->lpHdr->biBitCount; + surface_desc.ddpfPixelFormat.dwRBitMask = mask[0]; + surface_desc.ddpfPixelFormat.dwGBitMask = mask[1]; + surface_desc.ddpfPixelFormat.dwBBitMask = mask[2]; + } } else { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Matteo Bruni <mbruni(a)codeweavers.com> --- dlls/ddraw/ddraw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 3e66b134a75..fb8895f01b2 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -1794,7 +1794,7 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes { WINED3DFMT_YUY2, WINED3DFMT_UYVY, WINED3DFMT_YV12, WINED3DFMT_DXT1, WINED3DFMT_DXT2, WINED3DFMT_DXT3, WINED3DFMT_DXT4, WINED3DFMT_DXT5, - WINED3DFMT_ATI2N, WINED3DFMT_NVHU, WINED3DFMT_NVHS + WINED3DFMT_ATI2N, WINED3DFMT_NVHU, WINED3DFMT_NVHS, WINED3DFMT_NV12, }; struct wined3d_display_mode mode; DWORD count = 0, i, outsize; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Matteo Bruni <mbruni(a)codeweavers.com> --- dlls/quartz/tests/vmr7.c | 2 +- dlls/quartz/vmr7.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 9502a994576..585f96f1c3c 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -3561,7 +3561,7 @@ static void test_renderless_formats(void) hr = IVMRSurfaceAllocatorNotify_SetDDrawDevice(notify, ddraw, MonitorFromWindow(window, MONITOR_DEFAULTTOPRIMARY)); presenter.ddraw = ddraw; - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); ref = get_refcount(ddraw); todo_wine ok(ref == 2, "Got unexpected refcount %ld.\n", ref); diff --git a/dlls/quartz/vmr7.c b/dlls/quartz/vmr7.c index 4263e79d54f..830822a21df 100644 --- a/dlls/quartz/vmr7.c +++ b/dlls/quartz/vmr7.c @@ -71,6 +71,8 @@ struct vmr7 IVMRSurfaceAllocator *allocator; IVMRImagePresenter *presenter; IDirectDrawSurface7 **surfaces; + IDirectDraw7 *ddraw; + HMONITOR monitor; DWORD surface_count; DWORD surface_index; DWORD_PTR cookie; @@ -1260,8 +1262,19 @@ static HRESULT WINAPI surface_allocator_notify_AdviseSurfaceAllocator( static HRESULT WINAPI surface_allocator_notify_SetDDrawDevice( IVMRSurfaceAllocatorNotify *iface, IDirectDraw7 *device, HMONITOR monitor) { - FIXME("iface %p, device %p, monitor %p, stub!\n", iface, device, monitor); - return E_NOTIMPL; + struct vmr7 *filter = impl_from_IVMRSurfaceAllocatorNotify(iface); + + TRACE("filter %p, device %p, monitor %p.\n", filter, device, monitor); + + if (!device || monitor == MONITOR_DEFAULTTONULL) + { + WARN("Invalid parameters.\n"); + return E_FAIL; + } + + filter->ddraw = device; + filter->monitor = monitor; + return S_OK; } static HRESULT WINAPI surface_allocator_notify_ChangeDDrawDevice( -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Henri Verbeet <hverbeet(a)locutus.nl> --- dlls/quartz/vmr7.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/dlls/quartz/vmr7.c b/dlls/quartz/vmr7.c index 830822a21df..1d862baeb07 100644 --- a/dlls/quartz/vmr7.c +++ b/dlls/quartz/vmr7.c @@ -285,8 +285,42 @@ static HRESULT vmr_render(struct strmbase_renderer *iface, IMediaSample *sample) return IVMRImagePresenter_PresentImage(filter->presenter, filter->cookie, &info); } +static BOOL fourcc_is_supported(IDirectDraw7 *ddraw, DWORD fourcc) +{ + DWORD *codes, count, i; + HRESULT hr; + + if (FAILED(hr = IDirectDraw7_GetFourCCCodes(ddraw, &count, NULL))) + { + ERR("Failed to get FOURCC code count, hr %#lx.\n", hr); + return FALSE; + } + + if (!count || !(codes = calloc(count, sizeof(*codes)))) + return FALSE; + + if (FAILED(hr = IDirectDraw7_GetFourCCCodes(ddraw, &count, codes))) + { + ERR("Failed to get FOURCC codes, hr %#lx.\n", hr); + free(codes); + return FALSE; + } + + for (i = 0; i < count; ++i) + { + if (codes[i] == fourcc) + break; + } + free(codes); + + return i < count; +} + static HRESULT vmr_query_accept(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt) { + struct vmr7 *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface); + const BITMAPINFOHEADER *bitmap_header = get_bitmap_header(mt); + if (!IsEqualIID(&mt->majortype, &MEDIATYPE_Video) || !mt->pbFormat) return S_FALSE; @@ -294,6 +328,15 @@ static HRESULT vmr_query_accept(struct strmbase_renderer *iface, const AM_MEDIA_ && !IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo2)) return S_FALSE; + if (bitmap_header->biCompression == BI_RGB || bitmap_header->biCompression == BI_BITFIELDS) + return S_OK; + + if (!filter->ddraw) + return S_OK; + + if (!fourcc_is_supported(filter->ddraw, bitmap_header->biCompression)) + return S_FALSE; + return S_OK; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Matteo Bruni <mbruni(a)codeweavers.com> --- dlls/quartz/vmr7.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/dlls/quartz/vmr7.c b/dlls/quartz/vmr7.c index 1d862baeb07..e9834e300b0 100644 --- a/dlls/quartz/vmr7.c +++ b/dlls/quartz/vmr7.c @@ -320,6 +320,8 @@ static HRESULT vmr_query_accept(struct strmbase_renderer *iface, const AM_MEDIA_ { struct vmr7 *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface); const BITMAPINFOHEADER *bitmap_header = get_bitmap_header(mt); + IDirectDraw7 *ddraw = filter->ddraw; + HRESULT hr = S_OK; if (!IsEqualIID(&mt->majortype, &MEDIATYPE_Video) || !mt->pbFormat) return S_FALSE; @@ -331,13 +333,19 @@ static HRESULT vmr_query_accept(struct strmbase_renderer *iface, const AM_MEDIA_ if (bitmap_header->biCompression == BI_RGB || bitmap_header->biCompression == BI_BITFIELDS) return S_OK; - if (!filter->ddraw) - return S_OK; + if (!ddraw) + { + if (FAILED(DirectDrawCreateEx(NULL, (void **)&ddraw, &IID_IDirectDraw7, NULL))) + return S_FALSE; + } - if (!fourcc_is_supported(filter->ddraw, bitmap_header->biCompression)) - return S_FALSE; + if (!fourcc_is_supported(ddraw, bitmap_header->biCompression)) + hr = S_FALSE; - return S_OK; + if (ddraw != filter->ddraw) + IDirectDraw7_Release(ddraw); + + return hr; } static HRESULT initialize_device(struct vmr7 *filter, VMRALLOCATIONINFO *info, DWORD count) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Matteo Bruni <mbruni(a)codeweavers.com> --- dlls/quartz/vmr7_presenter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/quartz/vmr7_presenter.c b/dlls/quartz/vmr7_presenter.c index 1abee7b957d..d1170792455 100644 --- a/dlls/quartz/vmr7_presenter.c +++ b/dlls/quartz/vmr7_presenter.c @@ -180,6 +180,12 @@ static HRESULT WINAPI surface_allocator_AllocateSurface(IVMRSurfaceAllocator *if TRACE("presenter %p, id %#Ix, info %p, count %p, surface %p.\n", presenter, id, info, count, surface); + if (info->lpHdr->biSize != sizeof(*info->lpHdr)) + { + WARN("Invalid BITMAPINFOHEADER size %lu.\n", info->lpHdr->biSize); + return DDERR_INVALIDPIXELFORMAT; + } + surface_desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_CAPS | DDSD_BACKBUFFERCOUNT; surface_desc.dwWidth = info->lpHdr->biWidth; surface_desc.dwHeight = info->lpHdr->biHeight; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Matteo Bruni <mbruni(a)codeweavers.com> --- dlls/quartz/tests/vmr7.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 585f96f1c3c..3771f025fe7 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -3689,11 +3689,13 @@ static void test_default_presenter_allocate(void) { WORD depth; DWORD compression; - DDPIXELFORMAT format; + BOOL expect_failure; } tests[] = { {32, BI_RGB}, + {16, BI_RGB, .expect_failure = TRUE}, + {24, BI_RGB, .expect_failure = TRUE}, {12, mmioFOURCC('N','V','1','2')}, {12, mmioFOURCC('Y','V','1','2')}, {16, mmioFOURCC('U','Y','V','Y')}, @@ -3769,11 +3771,14 @@ static void test_default_presenter_allocate(void) IDirectDraw7_Release(ddraw); + if (tests[i].expect_failure) + expect_hr = E_FAIL; hr = IVMRSurfaceAllocator_AllocateSurface(allocator, 0, &info, &count, &frontbuffer); ok(hr == expect_hr, "Got hr %#lx.\n", hr); - if (hr == VFW_E_DDRAW_CAPS_NOT_SUITABLE) + if (FAILED(hr)) { - skip("Format is not supported.\n"); + if (hr == VFW_E_DDRAW_CAPS_NOT_SUITABLE) + skip("Format is not supported.\n"); winetest_pop_context(); continue; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Matteo Bruni <mbruni(a)codeweavers.com> --- dlls/quartz/tests/vmr7.c | 41 ++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 3771f025fe7..90dadda5b08 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -3685,6 +3685,21 @@ static void test_default_presenter_allocate(void) .biPlanes = 1, }; + /* This works as BITMAPINFOHEADER + the three color masks for BI_BITFIELDS. */ + BITMAPV4HEADER bitmap_v4_header = + { + .bV4Size = sizeof(BITMAPV4HEADER), + .bV4Width = 32, + .bV4Height = 16, + .bV4Planes = 1, + .bV4BitCount = 16, + .bV4V4Compression = BI_BITFIELDS, + .bV4RedMask = 0x00ff0000, + .bV4GreenMask = 0x0000ff00, + .bV4BlueMask = 0x000000ff, + .bV4AlphaMask = 0, + }; + static const struct { WORD depth; @@ -3700,6 +3715,9 @@ static void test_default_presenter_allocate(void) {12, mmioFOURCC('Y','V','1','2')}, {16, mmioFOURCC('U','Y','V','Y')}, {16, mmioFOURCC('Y','U','Y','2')}, + {32, BI_BITFIELDS}, + {16, BI_BITFIELDS, .expect_failure = TRUE}, + {24, BI_BITFIELDS, .expect_failure = TRUE}, }; window = CreateWindowA("static", "quartz_test", WS_OVERLAPPEDWINDOW, 0, 0, @@ -3718,7 +3736,6 @@ static void test_default_presenter_allocate(void) info.dwInterlaceFlags = 0; info.szNativeSize.cx = info.szAspectRatio.cx = 640; info.szNativeSize.cy = info.szAspectRatio.cy = 480; - info.lpHdr = &bitmap_header; info.lpPixFmt = NULL; for (unsigned int i = 0; i < ARRAY_SIZE(tests); ++i) @@ -3727,10 +3744,22 @@ static void test_default_presenter_allocate(void) HRESULT expect_hr; DWORD count = 2; - winetest_push_context("Compression %#lx, depth %u", tests[i].compression, tests[i].depth); + winetest_push_context("Test %u: Compression %#lx, depth %u", i, tests[i].compression, tests[i].depth); - bitmap_header.biBitCount = tests[i].depth; - bitmap_header.biCompression = tests[i].compression; + if (tests[i].compression == BI_BITFIELDS) + { + info.lpHdr = (BITMAPINFOHEADER *)&bitmap_v4_header; + bitmap_v4_header.bV4BitCount = tests[i].depth; + bitmap_v4_header.bV4V4Compression = tests[i].compression; + bitmap_v4_header.bV4Size = sizeof(BITMAPINFOHEADER); + } + else + { + bitmap_header.biBitCount = tests[i].depth; + bitmap_header.biCompression = tests[i].compression; + info.lpHdr = &bitmap_header; + bitmap_header.biSize = sizeof(BITMAPINFOHEADER); + } ddraw = create_ddraw(window); @@ -3743,7 +3772,7 @@ static void test_default_presenter_allocate(void) desc.dwWidth = desc.dwHeight = 32; desc.dwBackBufferCount = 2; desc.ddpfPixelFormat.dwSize = sizeof(desc.ddpfPixelFormat); - if (tests[i].compression) + if (tests[i].compression != BI_RGB && tests[i].compression != BI_BITFIELDS) { desc.ddpfPixelFormat.dwFlags = DDPF_FOURCC; desc.ddpfPixelFormat.dwFourCC = tests[i].compression; @@ -3799,7 +3828,7 @@ static void test_default_presenter_allocate(void) ok(desc.dwHeight == 16, "Got height %lu.\n", desc.dwHeight); ok(desc.ddpfPixelFormat.dwSize == sizeof(desc.ddpfPixelFormat), "Got size %lu.\n", desc.ddpfPixelFormat.dwSize); - if (tests[i].compression) + if (tests[i].compression != BI_RGB && tests[i].compression != BI_BITFIELDS) { ok(desc.ddpfPixelFormat.dwFlags == DDPF_FOURCC, "Got flags %#lx.\n", desc.ddpfPixelFormat.dwFlags); ok(desc.ddpfPixelFormat.dwFourCC == bitmap_header.biCompression, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Matteo Bruni <mbruni(a)codeweavers.com> --- dlls/quartz/tests/vmr7.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 90dadda5b08..ea7757d19c6 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -3704,6 +3704,7 @@ static void test_default_presenter_allocate(void) { WORD depth; DWORD compression; + BOOL v4; BOOL expect_failure; } tests[] = @@ -3718,6 +3719,7 @@ static void test_default_presenter_allocate(void) {32, BI_BITFIELDS}, {16, BI_BITFIELDS, .expect_failure = TRUE}, {24, BI_BITFIELDS, .expect_failure = TRUE}, + {32, BI_BITFIELDS, .v4 = TRUE, .expect_failure = TRUE}, }; window = CreateWindowA("static", "quartz_test", WS_OVERLAPPEDWINDOW, 0, 0, @@ -3746,12 +3748,15 @@ static void test_default_presenter_allocate(void) winetest_push_context("Test %u: Compression %#lx, depth %u", i, tests[i].compression, tests[i].depth); - if (tests[i].compression == BI_BITFIELDS) + if (tests[i].v4 || tests[i].compression == BI_BITFIELDS) { info.lpHdr = (BITMAPINFOHEADER *)&bitmap_v4_header; bitmap_v4_header.bV4BitCount = tests[i].depth; bitmap_v4_header.bV4V4Compression = tests[i].compression; - bitmap_v4_header.bV4Size = sizeof(BITMAPINFOHEADER); + if (tests[i].v4) + bitmap_v4_header.bV4Size = sizeof(bitmap_v4_header); + else + bitmap_v4_header.bV4Size = sizeof(BITMAPINFOHEADER); } else { @@ -3801,7 +3806,7 @@ static void test_default_presenter_allocate(void) IDirectDraw7_Release(ddraw); if (tests[i].expect_failure) - expect_hr = E_FAIL; + expect_hr = tests[i].v4 ? DDERR_INVALIDPIXELFORMAT : E_FAIL; hr = IVMRSurfaceAllocator_AllocateSurface(allocator, 0, &info, &count, &frontbuffer); ok(hr == expect_hr, "Got hr %#lx.\n", hr); if (FAILED(hr)) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
From: Matteo Bruni <mbruni(a)codeweavers.com> --- dlls/quartz/tests/vmr7.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index ea7757d19c6..a77d02ade97 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -27,6 +27,8 @@ #include "wine/strmbase.h" #include "wine/test.h" +static const GUID MEDIASUBTYPE_IV50 = {mmioFOURCC('I','V','5','0'), 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; + static IBaseFilter *create_vmr7(DWORD mode) { IBaseFilter *filter = NULL; @@ -3534,6 +3536,7 @@ static void test_renderless_formats(void) const GUID *subtype; WORD depth; DWORD compression; + BOOL must_fail; } tests[] = { @@ -3542,6 +3545,8 @@ static void test_renderless_formats(void) {&MEDIASUBTYPE_YV12, 12, mmioFOURCC('Y','V','1','2')}, {&MEDIASUBTYPE_UYVY, 16, mmioFOURCC('U','Y','V','Y')}, {&MEDIASUBTYPE_YUY2, 16, mmioFOURCC('Y','U','Y','2')}, + {&MEDIASUBTYPE_IV50, 16, mmioFOURCC('I','V','5','0')}, + {&MEDIASUBTYPE_WAVE, 16, mmioFOURCC('W','A','V','E'), TRUE}, }; AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE); @@ -3588,12 +3593,17 @@ static void test_renderless_formats(void) vih.bmiHeader.biCompression = tests[i].compression; hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &req_mt); - /* Connection never fails on native, but Wine currently creates - * surfaces during IPin::ReceiveConnection() instead of - * IMemAllocator::SetProperties(), so let that fail here for now. */ + /* Wine currently creates surfaces during IPin::ReceiveConnection() + * instead of IMemAllocator::SetProperties(), so accept those extra + * failures here for now. */ + if (tests[i].must_fail) + ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr); + else + ok(hr == S_OK || hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#lx.\n", hr); if (hr != S_OK) { - skip("Format is not supported, hr %#lx.\n", hr); + if (!tests[i].must_fail) + skip("Format is not supported, hr %#lx.\n", hr); winetest_pop_context(); continue; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
Somehow I ended up with one more patch than before :rolling_eyes: -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9520#note_124715
This merge request was approved by Elizabeth Figura. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9520
participants (4)
-
Elizabeth Figura (@zfigura) -
Henri Verbeet -
Matteo Bruni -
Matteo Bruni (@Mystral)