Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
July 2020
- 75 participants
- 1942 messages
Re: Re: [RFC PATCH] dxva2: Stub out DXVA-HD API.
by Marvin
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=76379
Your paranoid android.
=== build (build log) ===
error: corrupt patch at line 1486
Task: Patch failed to apply
=== debiant (build log) ===
Task: Patch failed to apply
=== debiant (build log) ===
Task: Patch failed to apply
July 31, 2020
Re: [RFC PATCH] dxva2: Stub out DXVA-HD API.
by Vijay Kiran Kamuju
On Fri, 31 Jul 2020, 18:03 Jeff Smith, <whydoubt(a)gmail.com> wrote:
> Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
> ---
> dlls/dxva2/Makefile.in | 3 +-
> dlls/dxva2/dxva2.spec | 1 +
> dlls/dxva2/dxvahd.c | 465 ++++++++++++++++++++++++++++++++++
> dlls/dxva2/tests/Makefile.in | 3 +-
> dlls/dxva2/tests/dxvahd.c | 293 ++++++++++++++++++++++
> include/Makefile.in | 1 +
> include/dxvahd.idl | 473 +++++++++++++++++++++++++++++++++++
> 7 files changed, 1237 insertions(+), 2 deletions(-)
> create mode 100644 dlls/dxva2/dxvahd.c
> create mode 100644 dlls/dxva2/tests/dxvahd.c
> create mode 100644 include/dxvahd.idl
>
> diff --git a/dlls/dxva2/Makefile.in b/dlls/dxva2/Makefile.in
> index e3fc2fd6c3a..0248c7f20b0 100644
> --- a/dlls/dxva2/Makefile.in
> +++ b/dlls/dxva2/Makefile.in
> @@ -5,4 +5,5 @@ IMPORTLIB = dxva2
> EXTRADLLFLAGS = -mno-cygwin
>
> C_SRCS = \
> - main.c
> + main.c \
> + dxvahd.c
> diff --git a/dlls/dxva2/dxva2.spec b/dlls/dxva2/dxva2.spec
> index 024a972697d..ea7a98718b0 100644
> --- a/dlls/dxva2/dxva2.spec
> +++ b/dlls/dxva2/dxva2.spec
> @@ -1,6 +1,7 @@
> @ stdcall CapabilitiesRequestAndCapabilitiesReply(ptr ptr long)
> @ stdcall DXVA2CreateDirect3DDeviceManager9(ptr ptr)
> @ stdcall DXVA2CreateVideoService(ptr ptr ptr)
> +@ stdcall DXVAHD_CreateDevice(ptr ptr long ptr ptr)
> @ stdcall DegaussMonitor(ptr)
> @ stdcall DestroyPhysicalMonitor(ptr)
> @ stdcall DestroyPhysicalMonitors(long ptr)
> diff --git a/dlls/dxva2/dxvahd.c b/dlls/dxva2/dxvahd.c
> new file mode 100644
> index 00000000000..7c197b9a2f8
> --- /dev/null
> +++ b/dlls/dxva2/dxvahd.c
> @@ -0,0 +1,465 @@
> +#define COBJMACROS
> +
> +#include "d3d9.h"
> +#include "initguid.h"
> +#include "dxvahd.h"
> +
> +#include "wine/debug.h"
> +#include "wine/heap.h"
> +
> +WINE_DEFAULT_DEBUG_CHANNEL(dxva2);
> +
> +
> +static const D3DFORMAT output_formats[] = {
> + D3DFMT_R8G8B8
> +};
> +
> +static const D3DFORMAT input_formats[] = {
> + MAKEFOURCC('N','V','1','2')
> +};
> +
> +static const DXVAHD_VPCAPS video_processors[] = {
> +
> {{0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, 0,
> 0, 0, 0, 0}
> +};
> +
> +static const DXVAHD_VPDEVCAPS dev_caps = {
> + DXVAHD_DEVICE_TYPE_HARDWARE,
> + 0, /* DeviceCaps */
> + 0, /* FeatureCaps */
> + 0, /* FilterCaps */
> + 0, /* InputFormatCaps */
> + D3DPOOL_DEFAULT,
> + ARRAY_SIZE(output_formats),
> + ARRAY_SIZE(input_formats),
> + ARRAY_SIZE(video_processors),
> + 1, /* MaxInputStreams */
> + 1 /* MaxStreamStates */
> +};
> +
> +
> +struct dxvahd_device
> +{
> + IDXVAHD_Device IDXVAHD_Device_iface;
> + LONG refcount;
> + IDirect3DDevice9Ex *d3d_device;
> +};
> +
> +struct dxvahd_vp
> +{
> + IDXVAHD_VideoProcessor IDXVAHD_VideoProcessor_iface;
> + LONG refcount;
> + GUID guid;
> +};
> +
> +
> +/********************************************
> + * Utility functions
> + */
> +
> +static struct dxvahd_device *impl_from_IDXVAHD_Device(IDXVAHD_Device
> *iface)
> +{
> + return CONTAINING_RECORD(iface, struct dxvahd_device,
> IDXVAHD_Device_iface);
> +}
> +
> +static struct dxvahd_vp
> *impl_from_IDXVAHD_VideoProcessor(IDXVAHD_VideoProcessor *iface)
> +{
> + return CONTAINING_RECORD(iface, struct dxvahd_vp,
> IDXVAHD_VideoProcessor_iface);
> +}
> +
> +static const char *debug_dxvahd_bltstate(DXVAHD_BLT_STATE blt_state)
> +{
> + switch (blt_state)
> + {
> +#define STATE_TO_STR(e) case e: return #e
> + STATE_TO_STR(DXVAHD_BLT_STATE_TARGET_RECT);
> + STATE_TO_STR(DXVAHD_BLT_STATE_BACKGROUND_COLOR);
> + STATE_TO_STR(DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE);
> + STATE_TO_STR(DXVAHD_BLT_STATE_ALPHA_FILL);
> + STATE_TO_STR(DXVAHD_BLT_STATE_CONSTRICTION);
> + STATE_TO_STR(DXVAHD_BLT_STATE_PRIVATE);
> +#undef STATE_TO_STR
> + default:
> + FIXME("Unrecognized blt state %#x.\n", blt_state);
> + return "unrecognized";
> + }
> +}
> +
> +static const char *debug_dxvahd_streamstate(DXVAHD_STREAM_STATE
> stream_state)
> +{
> + switch (stream_state)
> + {
> +#define STATE_TO_STR(e) case e: return #e
> + STATE_TO_STR(DXVAHD_STREAM_STATE_D3DFORMAT);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_FRAME_FORMAT);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_OUTPUT_RATE);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_SOURCE_RECT);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_DESTINATION_RECT);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_ALPHA);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_PALETTE);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_LUMA_KEY);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_ASPECT_RATIO);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_CONTRAST);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_HUE);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_SATURATION);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING);
> + STATE_TO_STR(DXVAHD_STREAM_STATE_PRIVATE);
> +#undef STATE_TO_STR
> + default:
> + FIXME("Unrecognized stream state %#x.\n", stream_state);
> + return "unrecognized";
> + }
> +}
> +
> +static const char *debug_dxvahd_surface_type(DXVAHD_SURFACE_TYPE
> surface_type)
> +{
> + switch (surface_type)
> + {
> +#define SURFACE_TYPE_TO_STR(e) case e: return #e
> + SURFACE_TYPE_TO_STR(DXVAHD_SURFACE_TYPE_VIDEO_INPUT);
> + SURFACE_TYPE_TO_STR(DXVAHD_SURFACE_TYPE_VIDEO_INPUT_PRIVATE);
> + SURFACE_TYPE_TO_STR(DXVAHD_SURFACE_TYPE_VIDEO_OUTPUT);
> +#undef SURFACE_TYPE_TO_STR
> + default:
> + FIXME("Unrecognized surface type %#x.\n", surface_type);
> + return "unrecognized";
> + }
> +}
> +
> +static const char *debug_dxvahd_filter(DXVAHD_FILTER filter)
> +{
> + switch (filter)
> + {
> +#define FILTER_TO_STR(e) case e: return #e
> + FILTER_TO_STR(DXVAHD_FILTER_BRIGHTNESS);
> + FILTER_TO_STR(DXVAHD_FILTER_CONTRAST);
> + FILTER_TO_STR(DXVAHD_FILTER_HUE);
> + FILTER_TO_STR(DXVAHD_FILTER_SATURATION);
> + FILTER_TO_STR(DXVAHD_FILTER_NOISE_REDUCTION);
> + FILTER_TO_STR(DXVAHD_FILTER_EDGE_ENHANCEMENT);
> + FILTER_TO_STR(DXVAHD_FILTER_ANAMORPHIC_SCALING);
> +#undef FILTER_TO_STR
> + default:
> + FIXME("Unrecognized surface type %#x.\n", filter);
> + return "unrecognized";
> + }
> +}
> +
> +static const char *debug_dxvahd_device_usage(DXVAHD_DEVICE_USAGE usage)
> +{
> + switch (usage)
> + {
> +#define USAGE_TO_STR(e) case e: return #e
> + USAGE_TO_STR(DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL);
> + USAGE_TO_STR(DXVAHD_DEVICE_USAGE_OPTIMAL_SPEED);
> + USAGE_TO_STR(DXVAHD_DEVICE_USAGE_OPTIMAL_QUALITY);
> +#undef USAGE_TO_STR
> + default:
> + FIXME("Unrecognized device usage %#x.\n", usage);
> + return "unrecognized";
> + }
> +}
> +
> +
> +/********************************************
> + * IDXVAHD_VideoProcessor functions
> + */
> +
> +static HRESULT WINAPI dxvahd_vp_QueryInterface(IDXVAHD_VideoProcessor
> *iface, REFIID riid, void **obj)
> +{
> + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
> +
> + WARN("Unsupported interface %s.\n", debugstr_guid(riid));
> + *obj = NULL;
> + return E_NOINTERFACE;
> +}
> +
> +static ULONG WINAPI dxvahd_vp_AddRef(IDXVAHD_VideoProcessor *iface)
> +{
> + struct dxvahd_vp *processor = impl_from_IDXVAHD_VideoProcessor(iface);
> + ULONG refcount = InterlockedIncrement(&processor->refcount);
> +
> + TRACE("%p, refcount %u.\n", iface, refcount);
> +
> + return refcount;
> +}
> +
> +static ULONG WINAPI dxvahd_vp_Release(IDXVAHD_VideoProcessor *iface)
> +{
> + struct dxvahd_vp *processor = impl_from_IDXVAHD_VideoProcessor(iface);
> + ULONG refcount = InterlockedDecrement(&processor->refcount);
> +
> + TRACE("%p, refcount %u.\n", iface, refcount);
> +
> + if (!refcount)
> + {
> + heap_free(processor);
> + }
> +
> + return refcount;
> +}
> +
> +static HRESULT WINAPI
> dxvahd_vp_SetVideoProcessBltState(IDXVAHD_VideoProcessor *iface,
> + DXVAHD_BLT_STATE State, UINT DataSize, const void *pData)
> +{
> + FIXME("%p, %s, %u, %p.\n", iface, debug_dxvahd_bltstate(State),
> DataSize, pData);
> + return S_OK;
> +}
> +
> +static HRESULT WINAPI
> dxvahd_vp_GetVideoProcessBltState(IDXVAHD_VideoProcessor *iface,
> + DXVAHD_BLT_STATE State, UINT DataSize, void *pData)
> +{
> + FIXME("%p, %s, %u, %p.\n", iface, debug_dxvahd_bltstate(State),
> DataSize, pData);
> + return S_OK;
> +}
> +
> +static HRESULT WINAPI
> dxvahd_vp_SetVideoProcessStreamState(IDXVAHD_VideoProcessor *iface,
> + UINT StreamNumber, DXVAHD_STREAM_STATE State, UINT DataSize,
> const void *pData)
> +{
> + FIXME("%p, %u, %s, %u, %p.\n", iface, StreamNumber,
> debug_dxvahd_streamstate(State), DataSize, pData);
> + return S_OK;
> +}
> +
> +static HRESULT WINAPI
> dxvahd_vp_GetVideoProcessStreamState(IDXVAHD_VideoProcessor *iface,
> + UINT StreamNumber, DXVAHD_STREAM_STATE State, UINT DataSize, void
> *pData)
> +{
> + FIXME("%p, %u, %s, %u, %p.\n", iface, StreamNumber,
> debug_dxvahd_streamstate(State), DataSize, pData);
> + return S_OK;
> +}
> +
> +static HRESULT WINAPI dxvahd_vp_VideoProcessBltHD(IDXVAHD_VideoProcessor
> *iface,
> + IDirect3DSurface9 *pOutputSurface, UINT OutputFrame, UINT
> StreamCount,
> + const DXVAHD_STREAM_DATA *pStreams)
> +{
> + UINT i;
> +
> + FIXME("%p, %p, %u, %u, %p.\n", iface, pOutputSurface, OutputFrame,
> StreamCount, pStreams);
> +
> + for (i = 0; i < StreamCount; i++)
> + {
> + TRACE("stream[%d]: %d %u %u %u %u %p %p %p\n", i,
> pStreams[i].Enable, pStreams[i].OutputIndex,
> + pStreams[i].InputFrameOrField, pStreams[i].PastFrames,
> pStreams[i].FutureFrames,
> + pStreams[i].ppPastSurfaces, pStreams[i].pInputSurface,
> pStreams[i].ppFutureSurfaces);
> + }
> +
> + return S_OK;
> +}
> +
> +static const IDXVAHD_VideoProcessorVtbl dxvahd_vp_vtbl =
> +{
> + dxvahd_vp_QueryInterface,
> + dxvahd_vp_AddRef,
> + dxvahd_vp_Release,
> + dxvahd_vp_SetVideoProcessBltState,
> + dxvahd_vp_GetVideoProcessBltState,
> + dxvahd_vp_SetVideoProcessStreamState,
> + dxvahd_vp_GetVideoProcessStreamState,
> + dxvahd_vp_VideoProcessBltHD,
> +};
> +
> +
> +/********************************************
> + * IDXVAHD_Device functions
> + */
> +
> +static HRESULT WINAPI dxvahd_device_QueryInterface(IDXVAHD_Device *iface,
> REFIID riid, void **obj)
> +{
> + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
> +
> + WARN("Unsupported interface %s.\n", debugstr_guid(riid));
> + *obj = NULL;
> + return E_NOINTERFACE;
> +}
> +
> +static ULONG WINAPI dxvahd_device_AddRef(IDXVAHD_Device *iface)
> +{
> + struct dxvahd_device *dev = impl_from_IDXVAHD_Device(iface);
> + ULONG refcount = InterlockedIncrement(&dev->refcount);
> +
> + TRACE("%p, refcount %u.\n", iface, refcount);
> +
> + return refcount;
> +}
> +
> +static ULONG WINAPI dxvahd_device_Release(IDXVAHD_Device *iface)
> +{
> + struct dxvahd_device *dev = impl_from_IDXVAHD_Device(iface);
> + ULONG refcount = InterlockedDecrement(&dev->refcount);
> +
> + TRACE("%p, refcount %u.\n", iface, refcount);
> +
> + if (!refcount)
> + {
> + heap_free(dev);
> + }
> +
> + return refcount;
> +}
> +
> +static HRESULT WINAPI dxvahd_device_CreateVideoSurface(IDXVAHD_Device
> *iface, UINT width, UINT height,
> + D3DFORMAT format, D3DPOOL pool, DWORD usage, DXVAHD_SURFACE_TYPE
> type, UINT num_surfaces,
> + IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle)
> +{
> + struct dxvahd_device *dev = impl_from_IDXVAHD_Device(iface);
> + UINT i;
> +
> + FIXME("%p, %u, %u, %#x, %#x, %#x, %s, %u, %p, %p.\n", iface, width,
> height, format, pool, usage,
> + debug_dxvahd_surface_type(type), num_surfaces, ppSurface,
> pSharedHandle);
> +
> + if (pool != dev_caps.InputPool || num_surfaces < 1)
> + return E_INVALIDARG;
> +
> + // FIXME: Return error result (D3DERR_INVALIDCALL or E_INVALIDARG) on
> invalid format.
> + // The formats returned by
> GetVideoProcessor[Input|Output]Formats functions
> + // may not comprise the entire set of valid formats.
> +
> + for (i = 0; i < num_surfaces; i++)
> + {
> + // TODO: Determine if CreateOffscreenPlainSurface is sufficient
> to the task,
> + // or if a separate implementation of IDirect3DSurface9 is
> warranted.
> + IDirect3DDevice9Ex_CreateOffscreenPlainSurface(dev->d3d_device,
> width, height, format, pool,
> + ppSurface + i, pSharedHandle);
> + TRACE("Created surface %d: %p.\n", i, ppSurface[i]);
> + }
> +
> + return S_OK;
> +}
> +
> +static HRESULT WINAPI
> dxvahd_device_GetVideoProcessorDeviceCaps(IDXVAHD_Device *iface,
> + DXVAHD_VPDEVCAPS *pCaps)
> +{
> + FIXME("%p, %p.\n", iface, pCaps);
> +
> + // TODO: use driver D3DDDICAPS_DXVAHD_GETVPDEVCAPS
> +
> + memcpy(pCaps, &dev_caps, sizeof(dev_caps));
> +
> + return S_OK;
> +}
> +
> +static HRESULT WINAPI
> dxvahd_device_GetVideoProcessorOutputFormats(IDXVAHD_Device *iface, UINT
> count,
> + D3DFORMAT *pFormats)
> +{
> + FIXME("%p, %u, %p.\n", iface, count, pFormats);
> +
> + // TODO: use driver D3DDDICAPS_DXVAHD_GETVPOUTPUTFORMATS
> +
> + if (count != dev_caps.OutputFormatCount)
> + return E_INVALIDARG;
> + memcpy(pFormats, output_formats, sizeof(output_formats));
> +
> + return S_OK;
> +}
> +
> +static HRESULT WINAPI
> dxvahd_device_GetVideoProcessorInputFormats(IDXVAHD_Device *iface, UINT
> count,
> + D3DFORMAT *pFormats)
> +{
> + FIXME("%p, %u, %p.\n", iface, count, pFormats);
> +
>
Avoid C++ style comments.
> + // TODO: use driver D3DDDICAPS_DXVAHD_GETVPINPUTFORMATS
> +
> + if (count != dev_caps.InputFormatCount)
> + return E_INVALIDARG;
> + memcpy(pFormats, input_formats, sizeof(input_formats));
> +
> + return S_OK;
> +}
> +
> +static HRESULT WINAPI dxvahd_device_GetVideoProcessorCaps(IDXVAHD_Device
> *iface, UINT count,
> + DXVAHD_VPCAPS *pCaps)
> +{
> + FIXME("%p, %u, %p.\n", iface, count, pCaps);
> +
>
Avoid C++ style comments.
> + // TODO: use driver D3DDDICAPS_DXVAHD_GETVPCAPS
> +
> + if (count != dev_caps.VideoProcessorCount)
> + return E_INVALIDARG;
> + memcpy(pCaps, video_processors, sizeof(video_processors));
> +
> + return S_OK;
> +}
> +
> +static HRESULT WINAPI
> dxvahd_device_GetVideoProcessorCustomRates(IDXVAHD_Device *iface,
> + const GUID *pVPGuid, UINT count, DXVAHD_CUSTOM_RATE_DATA *pRates)
> +{
> + FIXME("%p, %s, %u, %p.\n", iface, debugstr_guid(pVPGuid), count,
> pRates);
> +
>
Avoid C++ style comments.
> + // TODO: use driver D3DDDICAPS_DXVAHD_GETVPCUSTOMRATES
> +
> + return (!!count) ? E_INVALIDARG : S_OK;
> +}
> +
> +static HRESULT WINAPI
> dxvahd_device_GetVideoProcessorFilterRange(IDXVAHD_Device *iface,
> + DXVAHD_FILTER filter, DXVAHD_FILTER_RANGE_DATA *pRange)
> +{
> + FIXME("%p, %s, %p.\n", iface, debug_dxvahd_filter(filter), pRange);
> +
>
Avoid C++ style comments.
> + // TODO: use driver D3DDDICAPS_DXVAHD_GETVPFILTERRANGE
> +
> + return E_INVALIDARG;
> +}
> +
> +static HRESULT WINAPI dxvahd_device_CreateVideoProcessor(IDXVAHD_Device
> *iface, const GUID *pVPGuid,
> + IDXVAHD_VideoProcessor **ppVideoProcessor)
> +{
> + struct dxvahd_vp *object;
> +
> + FIXME("%p, %s, %p.\n", iface, debugstr_guid(pVPGuid),
> ppVideoProcessor);
> +
>
Avoid C++ style comments.
> + // TODO: use driver function CreateVideoProcessor
> +
> + if (!(object = heap_alloc_zero(sizeof(*object))))
> + return E_OUTOFMEMORY;
> +
> + object->IDXVAHD_VideoProcessor_iface.lpVtbl = &dxvahd_vp_vtbl;
> + object->refcount = 1;
> + memcpy(&object->guid, pVPGuid, sizeof(*pVPGuid));
> +
> + *ppVideoProcessor = &object->IDXVAHD_VideoProcessor_iface;
> +
> + return S_OK;
> +}
> +
> +static const IDXVAHD_DeviceVtbl dxvahd_device_vtbl =
> +{
> + dxvahd_device_QueryInterface,
> + dxvahd_device_AddRef,
> + dxvahd_device_Release,
> + dxvahd_device_CreateVideoSurface,
> + dxvahd_device_GetVideoProcessorDeviceCaps,
> + dxvahd_device_GetVideoProcessorOutputFormats,
> + dxvahd_device_GetVideoProcessorInputFormats,
> + dxvahd_device_GetVideoProcessorCaps,
> + dxvahd_device_GetVideoProcessorCustomRates,
> + dxvahd_device_GetVideoProcessorFilterRange,
> + dxvahd_device_CreateVideoProcessor,
> +};
> +
> +
> +HRESULT WINAPI DXVAHD_CreateDevice(IDirect3DDevice9Ex *d3d_device, const
> DXVAHD_CONTENT_DESC *desc,
> + DXVAHD_DEVICE_USAGE usage, PDXVAHDSW_Plugin plugin,
> IDXVAHD_Device **device)
> +{
> + struct dxvahd_device *object;
> +
> + TRACE("%p, %p, %s, %p, %p.\n", d3d_device, desc,
> debug_dxvahd_device_usage(usage), plugin, device);
> +
> + TRACE("Frame Format %d Input %ux%u @%.2f Output %ux%u @%.2f\n",
> + desc->InputFrameFormat, desc->InputWidth, desc->InputHeight,
> + (double)desc->InputFrameRate.Numerator /
> desc->InputFrameRate.Denominator,
> + desc->OutputWidth, desc->OutputHeight,
> + (double)desc->OutputFrameRate.Numerator /
> desc->OutputFrameRate.Denominator);
> +
> + if (!(object = heap_alloc_zero(sizeof(*object))))
> + return E_OUTOFMEMORY;
> +
> + object->IDXVAHD_Device_iface.lpVtbl = &dxvahd_device_vtbl;
> + object->refcount = 1;
> + object->d3d_device = d3d_device;
> +
> + *device = &object->IDXVAHD_Device_iface;
> +
> + return S_OK;
> +}
> diff --git a/dlls/dxva2/tests/Makefile.in b/dlls/dxva2/tests/Makefile.in
> index c86c5ab42fc..b5d70cd94f7 100644
> --- a/dlls/dxva2/tests/Makefile.in
> +++ b/dlls/dxva2/tests/Makefile.in
> @@ -2,4 +2,5 @@ TESTDLL = dxva2.dll
> IMPORTS = dxva2 user32 d3d9
>
> C_SRCS = \
> - dxva2.c
> + dxva2.c \
> + dxvahd.c
> diff --git a/dlls/dxva2/tests/dxvahd.c b/dlls/dxva2/tests/dxvahd.c
> new file mode 100644
> index 00000000000..e67350dfdb7
> --- /dev/null
> +++ b/dlls/dxva2/tests/dxvahd.c
> @@ -0,0 +1,293 @@
> +/*
> + * Copyright 2020 Jeff Smith
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
> USA
> + */
> +
> +#define COBJMACROS
> +#include "initguid.h"
> +#include "d3d9.h"
> +#include "dxvahd.h"
> +
> +#include "wine/test.h"
> +#include "wine/heap.h"
> +
> +IDirect3DDevice9Ex *d3d_device;
> +
> +static HWND create_window(void)
> +{
> + RECT r = {0, 0, 640, 480};
> +
> + AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW | WS_VISIBLE, FALSE);
> +
> + return CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW |
> WS_VISIBLE,
> + 0, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, NULL,
> NULL);
> +}
> +
> +static IDirect3DDevice9Ex *create_device(IDirect3D9Ex *d3d9, HWND
> focus_window)
> +{
> + D3DPRESENT_PARAMETERS present_parameters = {0};
> + IDirect3DDevice9Ex *device = NULL;
> +
> + present_parameters.BackBufferWidth = 640;
> + present_parameters.BackBufferHeight = 480;
> + present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
> + present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
> + present_parameters.hDeviceWindow = focus_window;
> + present_parameters.Windowed = TRUE;
> + present_parameters.EnableAutoDepthStencil = TRUE;
> + present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
> +
> + IDirect3D9Ex_CreateDeviceEx(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
> focus_window,
> + D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters,
> NULL, &device);
> +
> + return device;
> +}
> +
> +static void init_desc(DXVAHD_CONTENT_DESC *desc)
> +{
> + desc->InputFrameFormat = DXVAHD_FRAME_FORMAT_PROGRESSIVE;
> + desc->InputFrameRate.Numerator = 30;
> + desc->InputFrameRate.Denominator = 1;
> + desc->InputWidth = 640;
> + desc->InputHeight = 480;
> + desc->OutputFrameRate.Numerator = 30;
> + desc->OutputFrameRate.Denominator = 1;
> + desc->OutputWidth = 640;
> + desc->OutputHeight = 480;
> +}
> +
> +static void test_dxvahd_device(void)
> +{
> + IDXVAHD_Device *device, *device2;
> + IDirect3DSurface9 *surfaces[2];
> + HRESULT hr;
> + DXVAHD_CONTENT_DESC desc = {0};
> + DXVAHD_VPDEVCAPS caps = {0};
> + D3DFORMAT *input_formats;
> + D3DFORMAT *output_formats;
> + DXVAHD_VPCAPS *vp_caps;
> + int i;
> +
> + init_desc(&desc);
> + hr = DXVAHD_CreateDevice(d3d_device, &desc,
> DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &device);
> + ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
> + ok(!!device, "Failed to create DXVA-HD device.\n");
> +
> + hr = IDXVAHD_Device_QueryInterface(device, &IID_IDXVAHD_Device, (void
> **)&device2);
> + ok(hr == E_NOINTERFACE, "IDXVAHD_Device::QueryInterface for
> IID_IDXVAHD_Device returned %08x, expected E_NOINTERFACE\n", hr);
> + ok(device2 == NULL, "QueryInterface returned interface %p, expected
> NULL\n", device2);
> +
> + hr = IDXVAHD_Device_QueryInterface(device, &IID_IUnknown, (void
> **)&device2);
> + ok(hr == E_NOINTERFACE, "IDXVAHD_Device::QueryInterface for
> IID_IUnknown returned %08x, expected E_NOINTERFACE\n", hr);
> + ok(device2 == NULL, "QueryInterface returned interface %p, expected
> NULL\n", device2);
> +
> +
> + hr = IDXVAHD_Device_GetVideoProcessorDeviceCaps(device, &caps);
> + ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
> +
> + output_formats = heap_alloc_zero(caps.OutputFormatCount *
> sizeof(*output_formats));
> + hr = IDXVAHD_Device_GetVideoProcessorOutputFormats(device,
> caps.OutputFormatCount, output_formats);
> + ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
> + hr = IDXVAHD_Device_GetVideoProcessorOutputFormats(device,
> caps.OutputFormatCount + 1, output_formats);
> + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
> + if (caps.OutputFormatCount >= 1)
> + {
> + hr = IDXVAHD_Device_GetVideoProcessorOutputFormats(device,
> caps.OutputFormatCount - 1, output_formats);
> + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
> + }
> +
> + input_formats = heap_alloc_zero(caps.InputFormatCount *
> sizeof(*input_formats));
> + hr = IDXVAHD_Device_GetVideoProcessorInputFormats(device,
> caps.InputFormatCount, input_formats);
> + ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
> + hr = IDXVAHD_Device_GetVideoProcessorInputFormats(device,
> caps.InputFormatCount + 1, input_formats);
> + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
> + if (caps.InputFormatCount >= 1)
> + {
> + hr = IDXVAHD_Device_GetVideoProcessorInputFormats(device,
> caps.InputFormatCount - 1, input_formats);
> + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
> + }
> +
> + vp_caps = heap_alloc_zero(caps.VideoProcessorCount *
> sizeof(*vp_caps));
> + hr = IDXVAHD_Device_GetVideoProcessorCaps(device,
> caps.VideoProcessorCount, vp_caps);
> + ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
> + hr = IDXVAHD_Device_GetVideoProcessorCaps(device,
> caps.VideoProcessorCount + 1, vp_caps);
> + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
> + if (caps.VideoProcessorCount >= 1)
> + {
> + hr = IDXVAHD_Device_GetVideoProcessorCaps(device,
> caps.VideoProcessorCount - 1, vp_caps);
> + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
> + }
> +
> +
> + /* CreateVideoSurface: Try each input format */
> + for (i = 0; i < caps.InputFormatCount; i++)
> + {
> + hr = IDXVAHD_Device_CreateVideoSurface(device, 2, 2,
> input_formats[i], caps.InputPool, 0,
> + DXVAHD_SURFACE_TYPE_VIDEO_INPUT, 1, surfaces, NULL);
> + ok(hr == S_OK, "Unexpected hr %#x for input format %#x.\n", hr,
> input_formats[i]);
> + IDirect3DSurface9_Release(surfaces[0]);
> + }
> +
> + /* NOTE: some video surface formats besides those returned by
> + * GetVideoProcessor[Input|Output]Formats may be allowed by
> CreateVideoSurface. */
> +
> + /* CreateVideoSurface: Invalid input format */
> + hr = IDXVAHD_Device_CreateVideoSurface(device, 2, 2, 0xdeadbeef,
> caps.InputPool, 0,
> + DXVAHD_SURFACE_TYPE_VIDEO_INPUT, 1, surfaces, NULL);
> + todo_wine ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x for input
> format %#x.\n", hr, 0xdeadbeef);
> +
> + if (caps.InputFormatCount >= 1)
> + {
> + /* CreateVideoSurface: Request 0 surfaces */
> + hr = IDXVAHD_Device_CreateVideoSurface(device, 2, 2,
> input_formats[0], caps.InputPool, 0,
> + DXVAHD_SURFACE_TYPE_VIDEO_INPUT, 0, surfaces, NULL);
> + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
> + /* CreateVideoSurface: Wrong pool */
> + hr = IDXVAHD_Device_CreateVideoSurface(device, 2, 2,
> input_formats[0], caps.InputPool + 1, 0,
> + DXVAHD_SURFACE_TYPE_VIDEO_INPUT, 1, surfaces, NULL);
> + ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
> + }
> +
> +
> + heap_free(output_formats);
> + heap_free(input_formats);
> + heap_free(vp_caps);
> + IDXVAHD_Device_Release(device);
> +}
> +
> +static void test_dxvahd_processor(void)
> +{
> + IDXVAHD_Device *device;
> + DXVAHD_CONTENT_DESC desc = {0};
> + DXVAHD_VPDEVCAPS caps = {0};
> + D3DFORMAT *input_formats;
> + DXVAHD_VPCAPS *vp_caps;
> + IDXVAHD_VideoProcessor *processor;
> + void *data = heap_alloc_zero(64);
> + HRESULT hr;
> + int i;
> +
> + static struct {
> + DXVAHD_BLT_STATE state;
> + ULONG size;
> + } test_blt[] = {
> + {DXVAHD_BLT_STATE_TARGET_RECT,
> sizeof(DXVAHD_BLT_STATE_TARGET_RECT_DATA)},
> + {DXVAHD_BLT_STATE_BACKGROUND_COLOR,
> sizeof(DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA)},
> + {DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE,
> sizeof(DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA)},
> + {DXVAHD_BLT_STATE_ALPHA_FILL,
> sizeof(DXVAHD_BLT_STATE_ALPHA_FILL_DATA)},
> + {DXVAHD_BLT_STATE_CONSTRICTION,
> sizeof(DXVAHD_BLT_STATE_CONSTRICTION_DATA)},
> + };
> +
> + static struct {
> + DXVAHD_STREAM_STATE state;
> + ULONG size;
> + } test_stream[] = {
> + {DXVAHD_STREAM_STATE_D3DFORMAT,
> sizeof(DXVAHD_STREAM_STATE_D3DFORMAT_DATA)},
> + {DXVAHD_STREAM_STATE_FRAME_FORMAT,
> sizeof(DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA)},
> + {DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE,
> sizeof(DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA)},
> + {DXVAHD_STREAM_STATE_OUTPUT_RATE,
> sizeof(DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA)},
> + {DXVAHD_STREAM_STATE_SOURCE_RECT,
> sizeof(DXVAHD_STREAM_STATE_SOURCE_RECT_DATA)},
> + {DXVAHD_STREAM_STATE_DESTINATION_RECT,
> sizeof(DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA)},
> + {DXVAHD_STREAM_STATE_ALPHA,
> sizeof(DXVAHD_STREAM_STATE_ALPHA_DATA)},
> + {DXVAHD_STREAM_STATE_PALETTE,
> sizeof(DXVAHD_STREAM_STATE_PALETTE_DATA)},
> + {DXVAHD_STREAM_STATE_LUMA_KEY,
> sizeof(DXVAHD_STREAM_STATE_LUMA_KEY_DATA)},
> + {DXVAHD_STREAM_STATE_ASPECT_RATIO,
> sizeof(DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA)},
> + {DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS,
> sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
> + {DXVAHD_STREAM_STATE_FILTER_CONTRAST,
> sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
> + {DXVAHD_STREAM_STATE_FILTER_HUE,
> sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
> + {DXVAHD_STREAM_STATE_FILTER_SATURATION,
> sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
> + {DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION,
> sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
> + {DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT,
> sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
> + {DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING,
> sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
> + };
> +
> + init_desc(&desc);
> + DXVAHD_CreateDevice(d3d_device, &desc,
> DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &device);
> + IDXVAHD_Device_GetVideoProcessorDeviceCaps(device, &caps);
> + input_formats = heap_alloc_zero(caps.InputFormatCount *
> sizeof(*input_formats));
> + vp_caps = heap_alloc_zero(caps.VideoProcessorCount *
> sizeof(*vp_caps));
> + IDXVAHD_Device_GetVideoProcessorCaps(device,
> caps.VideoProcessorCount, vp_caps);
> +
> + hr = IDXVAHD_Device_CreateVideoProcessor(device, &vp_caps[0].VPGuid,
> &processor);
> + ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
> +
> + for (i = 0; i < ARRAY_SIZE(test_blt); i++)
> + {
> + hr = IDXVAHD_VideoProcessor_GetVideoProcessBltState(processor,
> test_blt[i].state, test_blt[i].size, data);
> + ok(hr == S_OK, "Unexpected hr %#x for blt state %#x.\n", hr,
> test_blt[i].state);
> + /* Pass wrong data size for state */
> + hr = IDXVAHD_VideoProcessor_GetVideoProcessBltState(processor,
> test_blt[i].state, 64, data);
> + todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x for blt state
> %#x.\n", hr, test_blt[i].state);
> + }
> +
> + for (i = 0; i < ARRAY_SIZE(test_stream); i++)
> + {
> + hr = IDXVAHD_VideoProcessor_GetVideoProcessStreamState(processor,
> 0, test_stream[i].state, test_stream[i].size, data);
> + ok(hr == S_OK, "Unexpected hr %#x for stream state %#x.\n", hr,
> test_stream[i].state);
> + /* Pass wrong data size for state */
> + hr = IDXVAHD_VideoProcessor_GetVideoProcessStreamState(processor,
> 0, test_stream[i].state, 64, data);
> + todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x for stream
> state %#x.\n", hr, test_stream[i].state);
> + }
> +
> + IDXVAHD_VideoProcessor_Release(processor);
> +
> + heap_free(data);
> + heap_free(input_formats);
> + heap_free(vp_caps);
> + IDXVAHD_Device_Release(device);
> +}
> +
> +START_TEST(dxvahd)
> +{
> + IDXVAHD_Device *device = NULL;
> + IDirect3D9Ex *d3d;
> + HWND window;
> + HRESULT hr;
> + DXVAHD_CONTENT_DESC desc = {0};
> +
> + hr = Direct3DCreate9Ex(D3D_SDK_VERSION, &d3d);
> + if (hr != S_OK)
> + {
> + skip("Failed to create a D3D object, skipping tests.\n");
> + return;
> + }
> +
> + window = create_window();
> +
> + if (!(d3d_device = create_device(d3d, window)))
> + {
> + skip("Failed to create a D3D device, skipping tests.\n");
> + IDirect3D9_Release(d3d);
> + DestroyWindow(window);
> + }
> +
> + init_desc(&desc);
> + hr = DXVAHD_CreateDevice(d3d_device, &desc,
> DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &device);
> + if (hr == E_NOINTERFACE)
> + {
> + skip("Device does not support DXVA-HD, skipping tests.\n");
> + goto done;
> + }
> + IDXVAHD_Device_Release(device);
> +
> + test_dxvahd_device();
> + test_dxvahd_processor();
> +
> +done:
> + IDirect3DDevice9_Release(d3d_device);
> + IDirect3D9_Release(d3d);
> + DestroyWindow(window);
> +}
> diff --git a/include/Makefile.in b/include/Makefile.in
> index 216adf0d7ae..f986ef42dd5 100644
> --- a/include/Makefile.in
> +++ b/include/Makefile.in
> @@ -268,6 +268,7 @@ SOURCES = \
> dxgitype.idl \
> dxva.h \
> dxva2api.idl \
> + dxvahd.idl \
> dyngraph.idl \
> endpointvolume.idl \
> errorrep.h \
> diff --git a/include/dxvahd.idl b/include/dxvahd.idl
> new file mode 100644
> index 00000000000..b6ed6b3217c
> --- /dev/null
> +++ b/include/dxvahd.idl
> @@ -0,0 +1,473 @@
> +/*
> + * Copyright 2020 Jeff Smith
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
> USA
> + */
> +
> +import "unknwn.idl";
> +
> +cpp_quote("#if 0")
> +interface IDirect3DDevice9Ex;
> +interface IDirect3DSurface9;
> +
> +typedef DWORD D3DFORMAT;
> +typedef DWORD D3DPOOL;
> +typedef DWORD D3DCOLOR;
> +cpp_quote("#endif")
> +
> +
> +typedef enum _DXVAHD_FRAME_FORMAT
> +{
> + DXVAHD_FRAME_FORMAT_PROGRESSIVE = 0,
> + DXVAHD_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1,
> + DXVAHD_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2
> +} DXVAHD_FRAME_FORMAT;
> +
> +typedef enum _DXVAHD_DEVICE_USAGE
> +{
> + DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL = 0,
> + DXVAHD_DEVICE_USAGE_OPTIMAL_SPEED = 1,
> + DXVAHD_DEVICE_USAGE_OPTIMAL_QUALITY = 2
> +} DXVAHD_DEVICE_USAGE;
> +
> +typedef enum _DXVAHD_FILTER
> +{
> + DXVAHD_FILTER_BRIGHTNESS = 0,
> + DXVAHD_FILTER_CONTRAST = 1,
> + DXVAHD_FILTER_HUE = 2,
> + DXVAHD_FILTER_SATURATION = 3,
> + DXVAHD_FILTER_NOISE_REDUCTION = 4,
> + DXVAHD_FILTER_EDGE_ENHANCEMENT = 5,
> + DXVAHD_FILTER_ANAMORPHIC_SCALING = 6
> +} DXVAHD_FILTER;
> +
> +typedef enum _DXVAHD_SURFACE_TYPE
> +{
> + DXVAHD_SURFACE_TYPE_VIDEO_INPUT = 0,
> + DXVAHD_SURFACE_TYPE_VIDEO_INPUT_PRIVATE = 1,
> + DXVAHD_SURFACE_TYPE_VIDEO_OUTPUT = 2
> +} DXVAHD_SURFACE_TYPE;
> +
> +typedef enum _DXVAHD_BLT_STATE
> +{
> + DXVAHD_BLT_STATE_TARGET_RECT = 0,
> + DXVAHD_BLT_STATE_BACKGROUND_COLOR = 1,
> + DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE = 2,
> + DXVAHD_BLT_STATE_ALPHA_FILL = 3,
> + DXVAHD_BLT_STATE_CONSTRICTION = 4,
> + DXVAHD_BLT_STATE_PRIVATE = 1000
> +} DXVAHD_BLT_STATE;
> +
> +typedef enum _DXVAHD_STREAM_STATE
> +{
> + DXVAHD_STREAM_STATE_D3DFORMAT = 0,
> + DXVAHD_STREAM_STATE_FRAME_FORMAT = 1,
> + DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE = 2,
> + DXVAHD_STREAM_STATE_OUTPUT_RATE = 3,
> + DXVAHD_STREAM_STATE_SOURCE_RECT = 4,
> + DXVAHD_STREAM_STATE_DESTINATION_RECT = 5,
> + DXVAHD_STREAM_STATE_ALPHA = 6,
> + DXVAHD_STREAM_STATE_PALETTE = 7,
> + DXVAHD_STREAM_STATE_LUMA_KEY = 8,
> + DXVAHD_STREAM_STATE_ASPECT_RATIO = 9,
> + DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS = 100,
> + DXVAHD_STREAM_STATE_FILTER_CONTRAST = 101,
> + DXVAHD_STREAM_STATE_FILTER_HUE = 102,
> + DXVAHD_STREAM_STATE_FILTER_SATURATION = 103,
> + DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION = 104,
> + DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT = 105,
> + DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING = 106,
> + DXVAHD_STREAM_STATE_PRIVATE = 1000
> +} DXVAHD_STREAM_STATE;
> +
> +typedef enum _DXVAHD_DEVICE_TYPE
> +{
> + DXVAHD_DEVICE_TYPE_HARDWARE = 0,
> + DXVAHD_DEVICE_TYPE_SOFTWARE = 1,
> + DXVAHD_DEVICE_TYPE_REFERENCE = 2,
> + DXVAHD_DEVICE_TYPE_OTHER = 3
> +} DXVAHD_DEVICE_TYPE;
> +
> +typedef enum _DXVAHD_DEVICE_CAPS
> +{
> + DXVAHD_DEVICE_CAPS_LINEAR_SPACE = 0x01,
> + DXVAHD_DEVICE_CAPS_xvYCC = 0x02,
> + DXVAHD_DEVICE_CAPS_RGB_RANGE_CONVERSION = 0x04,
> + DXVAHD_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = 0x08
>
Avoid C++ style comments.
> + // Based on DDI, Windows 8.1 should support:
> + // ..._NOMINAL_RANGE = 0x10
> +
> +} DXVAHD_DEVICE_CAPS;
> +
> +typedef enum _DXVAHD_FEATURE_CAPS
> +{
> + DXVAHD_FEATURE_CAPS_ALPHA_FILL = 0x01,
> + DXVAHD_FEATURE_CAPS_CONSTRICTION = 0x02,
> + DXVAHD_FEATURE_CAPS_LUMA_KEY = 0x04,
> + DXVAHD_FEATURE_CAPS_ALPHA_PALETTE = 0x08
>
Avoid C++ style comments.
> + // Based on DDI, Windows 8 should support:
> + // ..._ROTATION = 0x10
> +} DXVAHD_FEATURE_CAPS;
> +
> +typedef enum _DXVAHD_FILTER_CAPS
> +{
> + DXVAHD_FILTER_CAPS_BRIGHTNESS = 0x01,
> + DXVAHD_FILTER_CAPS_CONTRAST = 0x02,
> + DXVAHD_FILTER_CAPS_HUE = 0x04,
> + DXVAHD_FILTER_CAPS_SATURATION = 0x08,
> + DXVAHD_FILTER_CAPS_NOISE_REDUCTION = 0x10,
> + DXVAHD_FILTER_CAPS_EDGE_ENHANCEMENT = 0x20,
> + DXVAHD_FILTER_CAPS_ANAMORPHIC_SCALING = 0x40
> +} DXVAHD_FILTER_CAPS;
> +
> +typedef enum _DXVAHD_INPUT_FORMAT_CAPS
> +{
> + DXVAHD_INPUT_FORMAT_CAPS_RGB_INTERLACED = 0x01,
> + DXVAHD_INPUT_FORMAT_CAPS_RGB_PROCAMP = 0x02,
> + DXVAHD_INPUT_FORMAT_CAPS_RGB_LUMA_KEY = 0x04,
> + DXVAHD_INPUT_FORMAT_CAPS_PALETTE_INTERLACED = 0x08
> +} DXVAHD_INPUT_FORMAT_CAPS;
> +
> +typedef enum _DXVAHD_ALPHA_FILL_MODE
> +{
> + DXVAHD_ALPHA_FILL_MODE_OPAQUE = 0,
> + DXVAHD_ALPHA_FILL_MODE_BACKGROUND = 1,
> + DXVAHD_ALPHA_FILL_MODE_DESTINATION = 2,
> + DXVAHD_ALPHA_FILL_MODE_SOURCE_STREAM = 3
> +} DXVAHD_ALPHA_FILL_MODE;
> +
> +typedef enum _DXVAHD_OUTPUT_RATE
> +{
> + DXVAHD_OUTPUT_RATE_NORMAL = 0,
> + DXVAHD_OUTPUT_RATE_HALF = 1,
> + DXVAHD_OUTPUT_RATE_CUSTOM = 2
> +} DXVAHD_OUTPUT_RATE;
> +
> +
> +typedef struct _DXVAHD_RATIONAL
> +{
> + UINT Numerator;
> + UINT Denominator;
> +} DXVAHD_RATIONAL;
> +
> +typedef struct _DXVAHD_CONTENT_DESC
> +{
> + DXVAHD_FRAME_FORMAT InputFrameFormat;
> + DXVAHD_RATIONAL InputFrameRate;
> + UINT InputWidth;
> + UINT InputHeight;
> + DXVAHD_RATIONAL OutputFrameRate;
> + UINT OutputWidth;
> + UINT OutputHeight;
> +} DXVAHD_CONTENT_DESC;
> +
> +typedef struct _DXVAHD_VPCAPS
> +{
> + GUID VPGuid;
> + UINT PastFrames;
> + UINT FutureFrames;
> + UINT ProcessorCaps;
> + UINT ITelecineCaps;
> + UINT CustomRateCount;
> +} DXVAHD_VPCAPS;
> +
> +typedef struct _DXVAHD_CUSTOM_RATE_DATA
> +{
> + DXVAHD_RATIONAL CustomRate;
> + UINT OutputFrames;
> + BOOL InputInterlaced;
> + UINT InputFramesOrFields;
> +} DXVAHD_CUSTOM_RATE_DATA;
> +
> +typedef struct _DXVAHD_FILTER_RANGE_DATA
> +{
> + INT Minimum;
> + INT Maximum;
> + INT Default;
> + FLOAT Multiplier;
> +} DXVAHD_FILTER_RANGE_DATA;
> +
> +typedef struct _DXVAHD_VPDEVCAPS
> +{
> + DXVAHD_DEVICE_TYPE DeviceType;
> + UINT DeviceCaps;
> + UINT FeatureCaps;
> + UINT FilterCaps;
> + UINT InputFormatCaps;
> + D3DPOOL InputPool;
> + UINT OutputFormatCount;
> + UINT InputFormatCount;
> + UINT VideoProcessorCount;
> + UINT MaxInputStreams;
> + UINT MaxStreamStates;
> +} DXVAHD_VPDEVCAPS;
> +
> +typedef struct _DXVAHD_STREAM_DATA
> +{
> + BOOL Enable;
> + UINT OutputIndex;
> + UINT InputFrameOrField;
> + UINT PastFrames;
> + UINT FutureFrames;
> + IDirect3DSurface9 **ppPastSurfaces;
> + IDirect3DSurface9 *pInputSurface;
> + IDirect3DSurface9 **ppFutureSurfaces;
> +} DXVAHD_STREAM_DATA;
> +
> +typedef struct _DXVAHD_BLT_STATE_TARGET_RECT_DATA
> +{
> + BOOL Enable;
> + RECT TargetRect;
> +} DXVAHD_BLT_STATE_TARGET_RECT_DATA;
> +
> +typedef struct _DXVAHD_COLOR_RGBA
> +{
> + FLOAT R;
> + FLOAT G;
> + FLOAT B;
> + FLOAT A;
> +} DXVAHD_COLOR_RGBA;
> +
> +typedef struct _DXVAHD_COLOR_YCbCrA
> +{
> + FLOAT Y;
> + FLOAT Cb;
> + FLOAT Cr;
> + FLOAT A;
> +} DXVAHD_COLOR_YCbCrA;
> +
> +typedef union _DXVAHD_COLOR
> +{
> + DXVAHD_COLOR_RGBA RGB;
> + DXVAHD_COLOR_YCbCrA YCbCr;
> +} DXVAHD_COLOR;
> +
> +typedef struct _DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA
> +{
> + BOOL YCbCr;
> + DXVAHD_COLOR BackgroundColor;
> +} DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA;
> +
> +typedef struct _DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA
> +{
> + union
> + {
> + struct
> + {
> + UINT Usage : 1;
> + UINT RGB_Range : 1;
> + UINT YCbCr_Matrix : 1;
> + UINT YCbCr_xvYCC : 1;
> + UINT Reserved : 28;
> + };
> + UINT Value;
> + };
> +} DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA;
> +
> +typedef struct _DXVAHD_BLT_STATE_ALPHA_FILL_DATA
> +{
> + DXVAHD_ALPHA_FILL_MODE Mode;
> + UINT StreamNumber;
> +} DXVAHD_BLT_STATE_ALPHA_FILL_DATA;
> +
> +typedef struct _DXVAHD_BLT_STATE_CONSTRICTION_DATA
> +{
> + BOOL Enable;
> + SIZE Size;
> +} DXVAHD_BLT_STATE_CONSTRICTION_DATA;
> +
> +typedef struct _DXVAHD_BLT_STATE_PRIVATE_DATA
> +{
> + GUID Guid;
> + UINT DataSize;
> + void *pData;
> +} DXVAHD_BLT_STATE_PRIVATE_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_D3DFORMAT_DATA
> +{
> + D3DFORMAT Format;
> +} DXVAHD_STREAM_STATE_D3DFORMAT_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA
> +{
> + DXVAHD_FRAME_FORMAT FrameFormat;
> +} DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA
> +{
> + union
> + {
> + struct
> + {
> + UINT Type : 1;
> + UINT RGB_Range : 1;
> + UINT YCbCr_Matrix : 1;
> + UINT YCbCr_xvYCC : 1;
> + UINT Reserved : 28;
> + };
> + UINT Value;
> + };
> +} DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA
> +{
> + BOOL RepeatFrame;
> + DXVAHD_OUTPUT_RATE OutputRate;
> + DXVAHD_RATIONAL CustomRate;
> +} DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_SOURCE_RECT_DATA
> +{
> + BOOL Enable;
> + RECT SourceRect;
> +} DXVAHD_STREAM_STATE_SOURCE_RECT_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA
> +{
> + BOOL Enable;
> + RECT DestinationRect;
> +} DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_ALPHA_DATA
> +{
> + BOOL Enable;
> + FLOAT Alpha;
> +} DXVAHD_STREAM_STATE_ALPHA_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_PALETTE_DATA
> +{
> + UINT Count;
> + D3DCOLOR *pEntries;
> +} DXVAHD_STREAM_STATE_PALETTE_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_LUMA_KEY_DATA
> +{
> + BOOL Enable;
> + FLOAT Lower;
> + FLOAT Upper;
> +} DXVAHD_STREAM_STATE_LUMA_KEY_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA
> +{
> + BOOL Enable;
> + DXVAHD_RATIONAL SourceAspectRatio;
> + DXVAHD_RATIONAL DestinationAspectRatio;
> +} DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA;
> +
> +typedef struct _DXVAHD_STREAM_STATE_FILTER_DATA
> +{
> + BOOL Enable;
> + INT Level;
> +} DXVAHD_STREAM_STATE_FILTER_DATA;
> +
> +
>
+// FIXME
> +typedef void* PDXVAHDSW_Plugin;
> +
> +
> +interface IDXVAHD_Device;
> +interface IDXVAHD_VideoProcessor;
> +
> +cpp_quote("HRESULT WINAPI DXVAHD_CreateDevice(IDirect3DDevice9Ex
> *d3d_device, const DXVAHD_CONTENT_DESC *desc, DXVAHD_DEVICE_USAGE usage,
> PDXVAHDSW_Plugin plugin, IDXVAHD_Device **device);")
> +
>
> +/*****************************************************************************
> + * IDXVAHD_Device interface
> + */
> +[
> + object,
> + uuid(95f12dfd-d77e-49be-815f-57d579634d6d),
> + local
> +]
> +interface IDXVAHD_Device : IUnknown
> +{
> + HRESULT CreateVideoSurface(
> + [in] UINT width,
> + [in] UINT height,
> + [in] D3DFORMAT format,
> + [in] D3DPOOL pool,
> + [in] DWORD usage,
> + [in] DXVAHD_SURFACE_TYPE type,
> + [in] UINT num_surfaces,
> + [out] IDirect3DSurface9 **ppSurface,
> + [in, out] HANDLE *pSharedHandle);
> +
> + HRESULT GetVideoProcessorDeviceCaps(
> + [out] DXVAHD_VPDEVCAPS *pCaps);
> +
> + HRESULT GetVideoProcessorOutputFormats(
> + [in] UINT count,
> + [out] D3DFORMAT *pFormats);
> +
> + HRESULT GetVideoProcessorInputFormats(
> + [in] UINT count,
> + [out] D3DFORMAT *pFormats);
> +
> + HRESULT GetVideoProcessorCaps(
> + [in] UINT count,
> + [out] DXVAHD_VPCAPS *pCaps);
> +
> + HRESULT GetVideoProcessorCustomRates(
> + [in] const GUID *pVPGuid,
> + [in] UINT count,
> + [out] DXVAHD_CUSTOM_RATE_DATA *pRates);
> +
> + HRESULT GetVideoProcessorFilterRange(
> + [in] DXVAHD_FILTER filter,
> + [out] DXVAHD_FILTER_RANGE_DATA *pRange);
> +
> + HRESULT CreateVideoProcessor(
> + [in] const GUID *pVPGuid,
> + [out] IDXVAHD_VideoProcessor **ppVideoProcessor);
> +}
> +
> +
>
> +/*****************************************************************************
> + * IDXVAHD_VideoProcessor interface
> + */
> +[
> + object,
> + uuid(95f4edf4-6e03-4cd7-be1b-3075d665aa52),
> + local
> +]
> +interface IDXVAHD_VideoProcessor : IUnknown
> +{
> + HRESULT SetVideoProcessBltState(
> + [in] DXVAHD_BLT_STATE State,
> + [in] UINT DataSize,
> + [in] const void *pData);
> +
> + HRESULT GetVideoProcessBltState(
> + [in] DXVAHD_BLT_STATE State,
> + [in] UINT DataSize,
> + [out] void *pData);
> +
> + HRESULT SetVideoProcessStreamState(
> + [in] UINT StreamNumber,
> + [in] DXVAHD_STREAM_STATE State,
> + [in] UINT DataSize,
> + [in] const void *pData);
> +
> + HRESULT GetVideoProcessStreamState(
> + [in] UINT StreamNumber,
> + [in] DXVAHD_STREAM_STATE State,
> + [in] UINT DataSize,
> + [out] void *pData);
> +
> + HRESULT VideoProcessBltHD(
> + [in, out] IDirect3DSurface9 *pOutputSurface,
> + [in] UINT OutputFrame,
> + [in] UINT StreamCount,
> + [in] const DXVAHD_STREAM_DATA *pStreams);
> +}
> --
> 2.23.0
>
> Also this needs splitting up.
Thanks,
Vijay
July 31, 2020
RE: [PATCH 2/2] ntdll: Move InterlockedCompareExchange128 support to winnt.h.
by Puetz Kevin A
> Oh, I see, I didn't know it's already broken on aarch64. FWIW, I just wanted
> to fix a warning on clang msvcrt target and while doing that, I generalized the
> solution. We can wait with that for aarch64 solution.
Though what I was waiting on was to find out whether or was my problem
or somebody else's (i.e. would it still be an issue on our eventual BSP).
Which is, at least a bit, independent of whether wine needs a solution in general.
I probably should have at filed the bug anyway 😊
> Depending on -latomic may be problematic in PE builds. If I read libatomic
Mingw should have a -latomic too, it's the underlying runtime for the C++11 atomics
(but it just contains the C-API out-of-line implementations to fall back on
when there aren't appropriate intrinsics).
> source right, libatomic resorts to using lock in this case (pthread_mutex_lock
> or equivalent, depending on host).
Yes, that's what it does, which seemed equivalent to what wine had previously done,
and was easy to drop in as a workaround.
> We could probably just add a variant of affected RtlInterlocked*SList* functions
> that would use critical section instead of interlocked operations.
Yep. Or do what I think MS actually did, and implement the Header8 layout for when
you can't use double-pointer compare-and-exchange. They need that anyway,
(though maybe not anymore) since original amd64 CPUs don't have cmpxchg16b either.
I don't know the details on SLIST_HEADER::Header8 (presumably the same, just with
fewer bits in some of the fields), and there doesn't seem to be a lot of MSDN documentation
But here's some references I've dug up that at least mention it existed for such cases...
And obviously the Header8 struct in wine and reactos came from somewhere...
https://docs.microsoft.com/en-us/windows/win32/sync/interlocked-singly-link…
https://devblogs.microsoft.com/oldnewthing/20110819-00/?p=9853
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/m…
https://cbloomrants.blogspot.com/2010/05/05-29-10-lock-free-in-x64.html
> Thanks,
>
> Jacek
July 31, 2020
Re: [RFC PATCH] dxva2: Stub out DXVA-HD API.
by Marvin
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=76377
Your paranoid android.
=== w2008s64 (32 bit report) ===
dxva2:
dxvahd: Timeout
=== w2008s64 (64 bit report) ===
dxva2:
dxvahd: Timeout
July 31, 2020
Re: [PATCH v2] dmime: Parse TimeSig track data.
by Michael Stefaniuc
On 7/31/20 2:32 AM, Alistair Leslie-Hughes wrote:
> The tims data actually has a DWORD (size) before the structure.
That's because it is not one item but an array of items. This patch will
read only the first element.
I've seen that array pattern in the Tempo Track.
I have a cleanup patch for the Tempo Track but I'm not yet with the
patch. I have a structure too with an array[1] as last element, but I
need to pack the structure.
I have attached the patch so you can have a look at my implementation in
tempo_IPersistStream_Load().
Though I will redo my patch by exporting stream_read() from dmobject.c
and use that to first read the size DWORD and then just stream_read()
the array avoiding the variable size struct. Of course I'll still keep
the validation that the advertised size is a multiple of sizeof(item).
bye
michael
>
> Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
> ---
> dlls/dmime/timesigtrack.c | 61 +++++++++++++++++++++++++++++++++++++--
> 1 file changed, 59 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/dmime/timesigtrack.c b/dlls/dmime/timesigtrack.c
> index 697b3e3593b..f61e87806e9 100644
> --- a/dlls/dmime/timesigtrack.c
> +++ b/dlls/dmime/timesigtrack.c
> @@ -37,6 +37,11 @@ static inline IDirectMusicTimeSigTrack *impl_from_IDirectMusicTrack(IDirectMusic
> return CONTAINING_RECORD(iface, IDirectMusicTimeSigTrack, IDirectMusicTrack_iface);
> }
>
> +static inline IDirectMusicTimeSigTrack *impl_from_IPersistStream(IPersistStream *iface)
> +{
> + return CONTAINING_RECORD(iface, IDirectMusicTimeSigTrack, dmobj.IPersistStream_iface);
> +}
> +
> static HRESULT WINAPI IDirectMusicTrackImpl_QueryInterface(IDirectMusicTrack *iface, REFIID riid,
> void **ret_iface)
> {
> @@ -207,10 +212,62 @@ static const IDirectMusicTrackVtbl dmtack_vtbl = {
> IDirectMusicTrackImpl_Clone
> };
>
> +struct timesig_item
> +{
> + DWORD size;
> + DMUS_IO_TIMESIGNATURE_ITEM timesig;
> +};
> +
> +static HRESULT parse_timetrack_list(IDirectMusicTimeSigTrack *This, IStream *stream,
> + struct chunk_entry *timesig)
> +{
> + HRESULT hr;
> + struct chunk_entry chunk = {.parent = timesig};
> + struct timesig_item item;
> +
> + TRACE("Parsing segment form in %p: %s\n", stream, debugstr_chunk(timesig));
> +
> + while ((hr = stream_next_chunk(stream, &chunk)) == S_OK) {
> + if (chunk.id != DMUS_FOURCC_TIMESIGNATURE_TRACK)
> + return DMUS_E_UNSUPPORTED_STREAM;
> +
> + if (FAILED(hr = stream_chunk_get_data(stream, &chunk, &item, sizeof(item)))) {
> + WARN("Failed to read data of %s\n", debugstr_chunk(&chunk));
> + return hr;
> + }
> +
> + TRACE(" Size %d\n", item.size);
> +
> + TRACE("Found DMUS_IO_TIMESIGNATURE_ITEM\n");
> + TRACE(" - lTime %d\n", item.timesig.lTime);
> + TRACE(" - bBeatsPerMeasure %d\n", item.timesig.bBeatsPerMeasure);
> + TRACE(" - bBeat %d\n", item.timesig.bBeat);
> + TRACE(" - wGridsPerBeat %d\n", item.timesig.wGridsPerBeat);
> + }
> +
> + return SUCCEEDED(hr) ? S_OK : hr;
> +}
> +
> static HRESULT WINAPI time_IPersistStream_Load(IPersistStream *iface, IStream *stream)
> {
> - FIXME(": Loading not implemented yet\n");
> - return S_OK;
> + IDirectMusicTimeSigTrack *This = impl_from_IPersistStream(iface);
> + HRESULT hr;
> + struct chunk_entry chunk = {0};
> +
> + TRACE("%p, %p\n", This, stream);
> +
> + if (!stream)
> + return E_POINTER;
> +
> + if ((hr = stream_get_chunk(stream, &chunk) != S_OK))
> + return hr;
> +
> + if (chunk.id == FOURCC_LIST && chunk.type == DMUS_FOURCC_TIMESIGTRACK_LIST)
> + hr = parse_timetrack_list(This, stream, &chunk);
> + else
> + hr = DMUS_E_UNSUPPORTED_STREAM;
> +
> + return hr;
> }
>
> static const IPersistStreamVtbl persiststream_vtbl = {
>
July 31, 2020
Re: [PATCH vkd3d] include: Correct the case of rbtree macros.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
July 31, 2020
[RFC PATCH] dxva2: Stub out DXVA-HD API.
by Jeff Smith
Signed-off-by: Jeff Smith <whydoubt(a)gmail.com>
---
dlls/dxva2/Makefile.in | 3 +-
dlls/dxva2/dxva2.spec | 1 +
dlls/dxva2/dxvahd.c | 465 ++++++++++++++++++++++++++++++++++
dlls/dxva2/tests/Makefile.in | 3 +-
dlls/dxva2/tests/dxvahd.c | 293 ++++++++++++++++++++++
include/Makefile.in | 1 +
include/dxvahd.idl | 473 +++++++++++++++++++++++++++++++++++
7 files changed, 1237 insertions(+), 2 deletions(-)
create mode 100644 dlls/dxva2/dxvahd.c
create mode 100644 dlls/dxva2/tests/dxvahd.c
create mode 100644 include/dxvahd.idl
diff --git a/dlls/dxva2/Makefile.in b/dlls/dxva2/Makefile.in
index e3fc2fd6c3a..0248c7f20b0 100644
--- a/dlls/dxva2/Makefile.in
+++ b/dlls/dxva2/Makefile.in
@@ -5,4 +5,5 @@ IMPORTLIB = dxva2
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
- main.c
+ main.c \
+ dxvahd.c
diff --git a/dlls/dxva2/dxva2.spec b/dlls/dxva2/dxva2.spec
index 024a972697d..ea7a98718b0 100644
--- a/dlls/dxva2/dxva2.spec
+++ b/dlls/dxva2/dxva2.spec
@@ -1,6 +1,7 @@
@ stdcall CapabilitiesRequestAndCapabilitiesReply(ptr ptr long)
@ stdcall DXVA2CreateDirect3DDeviceManager9(ptr ptr)
@ stdcall DXVA2CreateVideoService(ptr ptr ptr)
+@ stdcall DXVAHD_CreateDevice(ptr ptr long ptr ptr)
@ stdcall DegaussMonitor(ptr)
@ stdcall DestroyPhysicalMonitor(ptr)
@ stdcall DestroyPhysicalMonitors(long ptr)
diff --git a/dlls/dxva2/dxvahd.c b/dlls/dxva2/dxvahd.c
new file mode 100644
index 00000000000..7c197b9a2f8
--- /dev/null
+++ b/dlls/dxva2/dxvahd.c
@@ -0,0 +1,465 @@
+#define COBJMACROS
+
+#include "d3d9.h"
+#include "initguid.h"
+#include "dxvahd.h"
+
+#include "wine/debug.h"
+#include "wine/heap.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dxva2);
+
+
+static const D3DFORMAT output_formats[] = {
+ D3DFMT_R8G8B8
+};
+
+static const D3DFORMAT input_formats[] = {
+ MAKEFOURCC('N','V','1','2')
+};
+
+static const DXVAHD_VPCAPS video_processors[] = {
+ {{0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, 0, 0, 0, 0, 0}
+};
+
+static const DXVAHD_VPDEVCAPS dev_caps = {
+ DXVAHD_DEVICE_TYPE_HARDWARE,
+ 0, /* DeviceCaps */
+ 0, /* FeatureCaps */
+ 0, /* FilterCaps */
+ 0, /* InputFormatCaps */
+ D3DPOOL_DEFAULT,
+ ARRAY_SIZE(output_formats),
+ ARRAY_SIZE(input_formats),
+ ARRAY_SIZE(video_processors),
+ 1, /* MaxInputStreams */
+ 1 /* MaxStreamStates */
+};
+
+
+struct dxvahd_device
+{
+ IDXVAHD_Device IDXVAHD_Device_iface;
+ LONG refcount;
+ IDirect3DDevice9Ex *d3d_device;
+};
+
+struct dxvahd_vp
+{
+ IDXVAHD_VideoProcessor IDXVAHD_VideoProcessor_iface;
+ LONG refcount;
+ GUID guid;
+};
+
+
+/********************************************
+ * Utility functions
+ */
+
+static struct dxvahd_device *impl_from_IDXVAHD_Device(IDXVAHD_Device *iface)
+{
+ return CONTAINING_RECORD(iface, struct dxvahd_device, IDXVAHD_Device_iface);
+}
+
+static struct dxvahd_vp *impl_from_IDXVAHD_VideoProcessor(IDXVAHD_VideoProcessor *iface)
+{
+ return CONTAINING_RECORD(iface, struct dxvahd_vp, IDXVAHD_VideoProcessor_iface);
+}
+
+static const char *debug_dxvahd_bltstate(DXVAHD_BLT_STATE blt_state)
+{
+ switch (blt_state)
+ {
+#define STATE_TO_STR(e) case e: return #e
+ STATE_TO_STR(DXVAHD_BLT_STATE_TARGET_RECT);
+ STATE_TO_STR(DXVAHD_BLT_STATE_BACKGROUND_COLOR);
+ STATE_TO_STR(DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE);
+ STATE_TO_STR(DXVAHD_BLT_STATE_ALPHA_FILL);
+ STATE_TO_STR(DXVAHD_BLT_STATE_CONSTRICTION);
+ STATE_TO_STR(DXVAHD_BLT_STATE_PRIVATE);
+#undef STATE_TO_STR
+ default:
+ FIXME("Unrecognized blt state %#x.\n", blt_state);
+ return "unrecognized";
+ }
+}
+
+static const char *debug_dxvahd_streamstate(DXVAHD_STREAM_STATE stream_state)
+{
+ switch (stream_state)
+ {
+#define STATE_TO_STR(e) case e: return #e
+ STATE_TO_STR(DXVAHD_STREAM_STATE_D3DFORMAT);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_FRAME_FORMAT);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_OUTPUT_RATE);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_SOURCE_RECT);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_DESTINATION_RECT);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_ALPHA);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_PALETTE);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_LUMA_KEY);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_ASPECT_RATIO);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_CONTRAST);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_HUE);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_SATURATION);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING);
+ STATE_TO_STR(DXVAHD_STREAM_STATE_PRIVATE);
+#undef STATE_TO_STR
+ default:
+ FIXME("Unrecognized stream state %#x.\n", stream_state);
+ return "unrecognized";
+ }
+}
+
+static const char *debug_dxvahd_surface_type(DXVAHD_SURFACE_TYPE surface_type)
+{
+ switch (surface_type)
+ {
+#define SURFACE_TYPE_TO_STR(e) case e: return #e
+ SURFACE_TYPE_TO_STR(DXVAHD_SURFACE_TYPE_VIDEO_INPUT);
+ SURFACE_TYPE_TO_STR(DXVAHD_SURFACE_TYPE_VIDEO_INPUT_PRIVATE);
+ SURFACE_TYPE_TO_STR(DXVAHD_SURFACE_TYPE_VIDEO_OUTPUT);
+#undef SURFACE_TYPE_TO_STR
+ default:
+ FIXME("Unrecognized surface type %#x.\n", surface_type);
+ return "unrecognized";
+ }
+}
+
+static const char *debug_dxvahd_filter(DXVAHD_FILTER filter)
+{
+ switch (filter)
+ {
+#define FILTER_TO_STR(e) case e: return #e
+ FILTER_TO_STR(DXVAHD_FILTER_BRIGHTNESS);
+ FILTER_TO_STR(DXVAHD_FILTER_CONTRAST);
+ FILTER_TO_STR(DXVAHD_FILTER_HUE);
+ FILTER_TO_STR(DXVAHD_FILTER_SATURATION);
+ FILTER_TO_STR(DXVAHD_FILTER_NOISE_REDUCTION);
+ FILTER_TO_STR(DXVAHD_FILTER_EDGE_ENHANCEMENT);
+ FILTER_TO_STR(DXVAHD_FILTER_ANAMORPHIC_SCALING);
+#undef FILTER_TO_STR
+ default:
+ FIXME("Unrecognized surface type %#x.\n", filter);
+ return "unrecognized";
+ }
+}
+
+static const char *debug_dxvahd_device_usage(DXVAHD_DEVICE_USAGE usage)
+{
+ switch (usage)
+ {
+#define USAGE_TO_STR(e) case e: return #e
+ USAGE_TO_STR(DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL);
+ USAGE_TO_STR(DXVAHD_DEVICE_USAGE_OPTIMAL_SPEED);
+ USAGE_TO_STR(DXVAHD_DEVICE_USAGE_OPTIMAL_QUALITY);
+#undef USAGE_TO_STR
+ default:
+ FIXME("Unrecognized device usage %#x.\n", usage);
+ return "unrecognized";
+ }
+}
+
+
+/********************************************
+ * IDXVAHD_VideoProcessor functions
+ */
+
+static HRESULT WINAPI dxvahd_vp_QueryInterface(IDXVAHD_VideoProcessor *iface, REFIID riid, void **obj)
+{
+ TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
+
+ WARN("Unsupported interface %s.\n", debugstr_guid(riid));
+ *obj = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI dxvahd_vp_AddRef(IDXVAHD_VideoProcessor *iface)
+{
+ struct dxvahd_vp *processor = impl_from_IDXVAHD_VideoProcessor(iface);
+ ULONG refcount = InterlockedIncrement(&processor->refcount);
+
+ TRACE("%p, refcount %u.\n", iface, refcount);
+
+ return refcount;
+}
+
+static ULONG WINAPI dxvahd_vp_Release(IDXVAHD_VideoProcessor *iface)
+{
+ struct dxvahd_vp *processor = impl_from_IDXVAHD_VideoProcessor(iface);
+ ULONG refcount = InterlockedDecrement(&processor->refcount);
+
+ TRACE("%p, refcount %u.\n", iface, refcount);
+
+ if (!refcount)
+ {
+ heap_free(processor);
+ }
+
+ return refcount;
+}
+
+static HRESULT WINAPI dxvahd_vp_SetVideoProcessBltState(IDXVAHD_VideoProcessor *iface,
+ DXVAHD_BLT_STATE State, UINT DataSize, const void *pData)
+{
+ FIXME("%p, %s, %u, %p.\n", iface, debug_dxvahd_bltstate(State), DataSize, pData);
+ return S_OK;
+}
+
+static HRESULT WINAPI dxvahd_vp_GetVideoProcessBltState(IDXVAHD_VideoProcessor *iface,
+ DXVAHD_BLT_STATE State, UINT DataSize, void *pData)
+{
+ FIXME("%p, %s, %u, %p.\n", iface, debug_dxvahd_bltstate(State), DataSize, pData);
+ return S_OK;
+}
+
+static HRESULT WINAPI dxvahd_vp_SetVideoProcessStreamState(IDXVAHD_VideoProcessor *iface,
+ UINT StreamNumber, DXVAHD_STREAM_STATE State, UINT DataSize, const void *pData)
+{
+ FIXME("%p, %u, %s, %u, %p.\n", iface, StreamNumber, debug_dxvahd_streamstate(State), DataSize, pData);
+ return S_OK;
+}
+
+static HRESULT WINAPI dxvahd_vp_GetVideoProcessStreamState(IDXVAHD_VideoProcessor *iface,
+ UINT StreamNumber, DXVAHD_STREAM_STATE State, UINT DataSize, void *pData)
+{
+ FIXME("%p, %u, %s, %u, %p.\n", iface, StreamNumber, debug_dxvahd_streamstate(State), DataSize, pData);
+ return S_OK;
+}
+
+static HRESULT WINAPI dxvahd_vp_VideoProcessBltHD(IDXVAHD_VideoProcessor *iface,
+ IDirect3DSurface9 *pOutputSurface, UINT OutputFrame, UINT StreamCount,
+ const DXVAHD_STREAM_DATA *pStreams)
+{
+ UINT i;
+
+ FIXME("%p, %p, %u, %u, %p.\n", iface, pOutputSurface, OutputFrame, StreamCount, pStreams);
+
+ for (i = 0; i < StreamCount; i++)
+ {
+ TRACE("stream[%d]: %d %u %u %u %u %p %p %p\n", i, pStreams[i].Enable, pStreams[i].OutputIndex,
+ pStreams[i].InputFrameOrField, pStreams[i].PastFrames, pStreams[i].FutureFrames,
+ pStreams[i].ppPastSurfaces, pStreams[i].pInputSurface, pStreams[i].ppFutureSurfaces);
+ }
+
+ return S_OK;
+}
+
+static const IDXVAHD_VideoProcessorVtbl dxvahd_vp_vtbl =
+{
+ dxvahd_vp_QueryInterface,
+ dxvahd_vp_AddRef,
+ dxvahd_vp_Release,
+ dxvahd_vp_SetVideoProcessBltState,
+ dxvahd_vp_GetVideoProcessBltState,
+ dxvahd_vp_SetVideoProcessStreamState,
+ dxvahd_vp_GetVideoProcessStreamState,
+ dxvahd_vp_VideoProcessBltHD,
+};
+
+
+/********************************************
+ * IDXVAHD_Device functions
+ */
+
+static HRESULT WINAPI dxvahd_device_QueryInterface(IDXVAHD_Device *iface, REFIID riid, void **obj)
+{
+ TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
+
+ WARN("Unsupported interface %s.\n", debugstr_guid(riid));
+ *obj = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI dxvahd_device_AddRef(IDXVAHD_Device *iface)
+{
+ struct dxvahd_device *dev = impl_from_IDXVAHD_Device(iface);
+ ULONG refcount = InterlockedIncrement(&dev->refcount);
+
+ TRACE("%p, refcount %u.\n", iface, refcount);
+
+ return refcount;
+}
+
+static ULONG WINAPI dxvahd_device_Release(IDXVAHD_Device *iface)
+{
+ struct dxvahd_device *dev = impl_from_IDXVAHD_Device(iface);
+ ULONG refcount = InterlockedDecrement(&dev->refcount);
+
+ TRACE("%p, refcount %u.\n", iface, refcount);
+
+ if (!refcount)
+ {
+ heap_free(dev);
+ }
+
+ return refcount;
+}
+
+static HRESULT WINAPI dxvahd_device_CreateVideoSurface(IDXVAHD_Device *iface, UINT width, UINT height,
+ D3DFORMAT format, D3DPOOL pool, DWORD usage, DXVAHD_SURFACE_TYPE type, UINT num_surfaces,
+ IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle)
+{
+ struct dxvahd_device *dev = impl_from_IDXVAHD_Device(iface);
+ UINT i;
+
+ FIXME("%p, %u, %u, %#x, %#x, %#x, %s, %u, %p, %p.\n", iface, width, height, format, pool, usage,
+ debug_dxvahd_surface_type(type), num_surfaces, ppSurface, pSharedHandle);
+
+ if (pool != dev_caps.InputPool || num_surfaces < 1)
+ return E_INVALIDARG;
+
+ // FIXME: Return error result (D3DERR_INVALIDCALL or E_INVALIDARG) on invalid format.
+ // The formats returned by GetVideoProcessor[Input|Output]Formats functions
+ // may not comprise the entire set of valid formats.
+
+ for (i = 0; i < num_surfaces; i++)
+ {
+ // TODO: Determine if CreateOffscreenPlainSurface is sufficient to the task,
+ // or if a separate implementation of IDirect3DSurface9 is warranted.
+ IDirect3DDevice9Ex_CreateOffscreenPlainSurface(dev->d3d_device, width, height, format, pool,
+ ppSurface + i, pSharedHandle);
+ TRACE("Created surface %d: %p.\n", i, ppSurface[i]);
+ }
+
+ return S_OK;
+}
+
+static HRESULT WINAPI dxvahd_device_GetVideoProcessorDeviceCaps(IDXVAHD_Device *iface,
+ DXVAHD_VPDEVCAPS *pCaps)
+{
+ FIXME("%p, %p.\n", iface, pCaps);
+
+ // TODO: use driver D3DDDICAPS_DXVAHD_GETVPDEVCAPS
+
+ memcpy(pCaps, &dev_caps, sizeof(dev_caps));
+
+ return S_OK;
+}
+
+static HRESULT WINAPI dxvahd_device_GetVideoProcessorOutputFormats(IDXVAHD_Device *iface, UINT count,
+ D3DFORMAT *pFormats)
+{
+ FIXME("%p, %u, %p.\n", iface, count, pFormats);
+
+ // TODO: use driver D3DDDICAPS_DXVAHD_GETVPOUTPUTFORMATS
+
+ if (count != dev_caps.OutputFormatCount)
+ return E_INVALIDARG;
+ memcpy(pFormats, output_formats, sizeof(output_formats));
+
+ return S_OK;
+}
+
+static HRESULT WINAPI dxvahd_device_GetVideoProcessorInputFormats(IDXVAHD_Device *iface, UINT count,
+ D3DFORMAT *pFormats)
+{
+ FIXME("%p, %u, %p.\n", iface, count, pFormats);
+
+ // TODO: use driver D3DDDICAPS_DXVAHD_GETVPINPUTFORMATS
+
+ if (count != dev_caps.InputFormatCount)
+ return E_INVALIDARG;
+ memcpy(pFormats, input_formats, sizeof(input_formats));
+
+ return S_OK;
+}
+
+static HRESULT WINAPI dxvahd_device_GetVideoProcessorCaps(IDXVAHD_Device *iface, UINT count,
+ DXVAHD_VPCAPS *pCaps)
+{
+ FIXME("%p, %u, %p.\n", iface, count, pCaps);
+
+ // TODO: use driver D3DDDICAPS_DXVAHD_GETVPCAPS
+
+ if (count != dev_caps.VideoProcessorCount)
+ return E_INVALIDARG;
+ memcpy(pCaps, video_processors, sizeof(video_processors));
+
+ return S_OK;
+}
+
+static HRESULT WINAPI dxvahd_device_GetVideoProcessorCustomRates(IDXVAHD_Device *iface,
+ const GUID *pVPGuid, UINT count, DXVAHD_CUSTOM_RATE_DATA *pRates)
+{
+ FIXME("%p, %s, %u, %p.\n", iface, debugstr_guid(pVPGuid), count, pRates);
+
+ // TODO: use driver D3DDDICAPS_DXVAHD_GETVPCUSTOMRATES
+
+ return (!!count) ? E_INVALIDARG : S_OK;
+}
+
+static HRESULT WINAPI dxvahd_device_GetVideoProcessorFilterRange(IDXVAHD_Device *iface,
+ DXVAHD_FILTER filter, DXVAHD_FILTER_RANGE_DATA *pRange)
+{
+ FIXME("%p, %s, %p.\n", iface, debug_dxvahd_filter(filter), pRange);
+
+ // TODO: use driver D3DDDICAPS_DXVAHD_GETVPFILTERRANGE
+
+ return E_INVALIDARG;
+}
+
+static HRESULT WINAPI dxvahd_device_CreateVideoProcessor(IDXVAHD_Device *iface, const GUID *pVPGuid,
+ IDXVAHD_VideoProcessor **ppVideoProcessor)
+{
+ struct dxvahd_vp *object;
+
+ FIXME("%p, %s, %p.\n", iface, debugstr_guid(pVPGuid), ppVideoProcessor);
+
+ // TODO: use driver function CreateVideoProcessor
+
+ if (!(object = heap_alloc_zero(sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ object->IDXVAHD_VideoProcessor_iface.lpVtbl = &dxvahd_vp_vtbl;
+ object->refcount = 1;
+ memcpy(&object->guid, pVPGuid, sizeof(*pVPGuid));
+
+ *ppVideoProcessor = &object->IDXVAHD_VideoProcessor_iface;
+
+ return S_OK;
+}
+
+static const IDXVAHD_DeviceVtbl dxvahd_device_vtbl =
+{
+ dxvahd_device_QueryInterface,
+ dxvahd_device_AddRef,
+ dxvahd_device_Release,
+ dxvahd_device_CreateVideoSurface,
+ dxvahd_device_GetVideoProcessorDeviceCaps,
+ dxvahd_device_GetVideoProcessorOutputFormats,
+ dxvahd_device_GetVideoProcessorInputFormats,
+ dxvahd_device_GetVideoProcessorCaps,
+ dxvahd_device_GetVideoProcessorCustomRates,
+ dxvahd_device_GetVideoProcessorFilterRange,
+ dxvahd_device_CreateVideoProcessor,
+};
+
+
+HRESULT WINAPI DXVAHD_CreateDevice(IDirect3DDevice9Ex *d3d_device, const DXVAHD_CONTENT_DESC *desc,
+ DXVAHD_DEVICE_USAGE usage, PDXVAHDSW_Plugin plugin, IDXVAHD_Device **device)
+{
+ struct dxvahd_device *object;
+
+ TRACE("%p, %p, %s, %p, %p.\n", d3d_device, desc, debug_dxvahd_device_usage(usage), plugin, device);
+
+ TRACE("Frame Format %d Input %ux%u @%.2f Output %ux%u @%.2f\n",
+ desc->InputFrameFormat, desc->InputWidth, desc->InputHeight,
+ (double)desc->InputFrameRate.Numerator / desc->InputFrameRate.Denominator,
+ desc->OutputWidth, desc->OutputHeight,
+ (double)desc->OutputFrameRate.Numerator / desc->OutputFrameRate.Denominator);
+
+ if (!(object = heap_alloc_zero(sizeof(*object))))
+ return E_OUTOFMEMORY;
+
+ object->IDXVAHD_Device_iface.lpVtbl = &dxvahd_device_vtbl;
+ object->refcount = 1;
+ object->d3d_device = d3d_device;
+
+ *device = &object->IDXVAHD_Device_iface;
+
+ return S_OK;
+}
diff --git a/dlls/dxva2/tests/Makefile.in b/dlls/dxva2/tests/Makefile.in
index c86c5ab42fc..b5d70cd94f7 100644
--- a/dlls/dxva2/tests/Makefile.in
+++ b/dlls/dxva2/tests/Makefile.in
@@ -2,4 +2,5 @@ TESTDLL = dxva2.dll
IMPORTS = dxva2 user32 d3d9
C_SRCS = \
- dxva2.c
+ dxva2.c \
+ dxvahd.c
diff --git a/dlls/dxva2/tests/dxvahd.c b/dlls/dxva2/tests/dxvahd.c
new file mode 100644
index 00000000000..e67350dfdb7
--- /dev/null
+++ b/dlls/dxva2/tests/dxvahd.c
@@ -0,0 +1,293 @@
+/*
+ * Copyright 2020 Jeff Smith
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+#include "initguid.h"
+#include "d3d9.h"
+#include "dxvahd.h"
+
+#include "wine/test.h"
+#include "wine/heap.h"
+
+IDirect3DDevice9Ex *d3d_device;
+
+static HWND create_window(void)
+{
+ RECT r = {0, 0, 640, 480};
+
+ AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW | WS_VISIBLE, FALSE);
+
+ return CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, NULL, NULL);
+}
+
+static IDirect3DDevice9Ex *create_device(IDirect3D9Ex *d3d9, HWND focus_window)
+{
+ D3DPRESENT_PARAMETERS present_parameters = {0};
+ IDirect3DDevice9Ex *device = NULL;
+
+ present_parameters.BackBufferWidth = 640;
+ present_parameters.BackBufferHeight = 480;
+ present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
+ present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
+ present_parameters.hDeviceWindow = focus_window;
+ present_parameters.Windowed = TRUE;
+ present_parameters.EnableAutoDepthStencil = TRUE;
+ present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
+
+ IDirect3D9Ex_CreateDeviceEx(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window,
+ D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, NULL, &device);
+
+ return device;
+}
+
+static void init_desc(DXVAHD_CONTENT_DESC *desc)
+{
+ desc->InputFrameFormat = DXVAHD_FRAME_FORMAT_PROGRESSIVE;
+ desc->InputFrameRate.Numerator = 30;
+ desc->InputFrameRate.Denominator = 1;
+ desc->InputWidth = 640;
+ desc->InputHeight = 480;
+ desc->OutputFrameRate.Numerator = 30;
+ desc->OutputFrameRate.Denominator = 1;
+ desc->OutputWidth = 640;
+ desc->OutputHeight = 480;
+}
+
+static void test_dxvahd_device(void)
+{
+ IDXVAHD_Device *device, *device2;
+ IDirect3DSurface9 *surfaces[2];
+ HRESULT hr;
+ DXVAHD_CONTENT_DESC desc = {0};
+ DXVAHD_VPDEVCAPS caps = {0};
+ D3DFORMAT *input_formats;
+ D3DFORMAT *output_formats;
+ DXVAHD_VPCAPS *vp_caps;
+ int i;
+
+ init_desc(&desc);
+ hr = DXVAHD_CreateDevice(d3d_device, &desc, DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &device);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ ok(!!device, "Failed to create DXVA-HD device.\n");
+
+ hr = IDXVAHD_Device_QueryInterface(device, &IID_IDXVAHD_Device, (void **)&device2);
+ ok(hr == E_NOINTERFACE, "IDXVAHD_Device::QueryInterface for IID_IDXVAHD_Device returned %08x, expected E_NOINTERFACE\n", hr);
+ ok(device2 == NULL, "QueryInterface returned interface %p, expected NULL\n", device2);
+
+ hr = IDXVAHD_Device_QueryInterface(device, &IID_IUnknown, (void **)&device2);
+ ok(hr == E_NOINTERFACE, "IDXVAHD_Device::QueryInterface for IID_IUnknown returned %08x, expected E_NOINTERFACE\n", hr);
+ ok(device2 == NULL, "QueryInterface returned interface %p, expected NULL\n", device2);
+
+
+ hr = IDXVAHD_Device_GetVideoProcessorDeviceCaps(device, &caps);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ output_formats = heap_alloc_zero(caps.OutputFormatCount * sizeof(*output_formats));
+ hr = IDXVAHD_Device_GetVideoProcessorOutputFormats(device, caps.OutputFormatCount, output_formats);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IDXVAHD_Device_GetVideoProcessorOutputFormats(device, caps.OutputFormatCount + 1, output_formats);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ if (caps.OutputFormatCount >= 1)
+ {
+ hr = IDXVAHD_Device_GetVideoProcessorOutputFormats(device, caps.OutputFormatCount - 1, output_formats);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ }
+
+ input_formats = heap_alloc_zero(caps.InputFormatCount * sizeof(*input_formats));
+ hr = IDXVAHD_Device_GetVideoProcessorInputFormats(device, caps.InputFormatCount, input_formats);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IDXVAHD_Device_GetVideoProcessorInputFormats(device, caps.InputFormatCount + 1, input_formats);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ if (caps.InputFormatCount >= 1)
+ {
+ hr = IDXVAHD_Device_GetVideoProcessorInputFormats(device, caps.InputFormatCount - 1, input_formats);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ }
+
+ vp_caps = heap_alloc_zero(caps.VideoProcessorCount * sizeof(*vp_caps));
+ hr = IDXVAHD_Device_GetVideoProcessorCaps(device, caps.VideoProcessorCount, vp_caps);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IDXVAHD_Device_GetVideoProcessorCaps(device, caps.VideoProcessorCount + 1, vp_caps);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ if (caps.VideoProcessorCount >= 1)
+ {
+ hr = IDXVAHD_Device_GetVideoProcessorCaps(device, caps.VideoProcessorCount - 1, vp_caps);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ }
+
+
+ /* CreateVideoSurface: Try each input format */
+ for (i = 0; i < caps.InputFormatCount; i++)
+ {
+ hr = IDXVAHD_Device_CreateVideoSurface(device, 2, 2, input_formats[i], caps.InputPool, 0,
+ DXVAHD_SURFACE_TYPE_VIDEO_INPUT, 1, surfaces, NULL);
+ ok(hr == S_OK, "Unexpected hr %#x for input format %#x.\n", hr, input_formats[i]);
+ IDirect3DSurface9_Release(surfaces[0]);
+ }
+
+ /* NOTE: some video surface formats besides those returned by
+ * GetVideoProcessor[Input|Output]Formats may be allowed by CreateVideoSurface. */
+
+ /* CreateVideoSurface: Invalid input format */
+ hr = IDXVAHD_Device_CreateVideoSurface(device, 2, 2, 0xdeadbeef, caps.InputPool, 0,
+ DXVAHD_SURFACE_TYPE_VIDEO_INPUT, 1, surfaces, NULL);
+ todo_wine ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x for input format %#x.\n", hr, 0xdeadbeef);
+
+ if (caps.InputFormatCount >= 1)
+ {
+ /* CreateVideoSurface: Request 0 surfaces */
+ hr = IDXVAHD_Device_CreateVideoSurface(device, 2, 2, input_formats[0], caps.InputPool, 0,
+ DXVAHD_SURFACE_TYPE_VIDEO_INPUT, 0, surfaces, NULL);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ /* CreateVideoSurface: Wrong pool */
+ hr = IDXVAHD_Device_CreateVideoSurface(device, 2, 2, input_formats[0], caps.InputPool + 1, 0,
+ DXVAHD_SURFACE_TYPE_VIDEO_INPUT, 1, surfaces, NULL);
+ ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+ }
+
+
+ heap_free(output_formats);
+ heap_free(input_formats);
+ heap_free(vp_caps);
+ IDXVAHD_Device_Release(device);
+}
+
+static void test_dxvahd_processor(void)
+{
+ IDXVAHD_Device *device;
+ DXVAHD_CONTENT_DESC desc = {0};
+ DXVAHD_VPDEVCAPS caps = {0};
+ D3DFORMAT *input_formats;
+ DXVAHD_VPCAPS *vp_caps;
+ IDXVAHD_VideoProcessor *processor;
+ void *data = heap_alloc_zero(64);
+ HRESULT hr;
+ int i;
+
+ static struct {
+ DXVAHD_BLT_STATE state;
+ ULONG size;
+ } test_blt[] = {
+ {DXVAHD_BLT_STATE_TARGET_RECT, sizeof(DXVAHD_BLT_STATE_TARGET_RECT_DATA)},
+ {DXVAHD_BLT_STATE_BACKGROUND_COLOR, sizeof(DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA)},
+ {DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE, sizeof(DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA)},
+ {DXVAHD_BLT_STATE_ALPHA_FILL, sizeof(DXVAHD_BLT_STATE_ALPHA_FILL_DATA)},
+ {DXVAHD_BLT_STATE_CONSTRICTION, sizeof(DXVAHD_BLT_STATE_CONSTRICTION_DATA)},
+ };
+
+ static struct {
+ DXVAHD_STREAM_STATE state;
+ ULONG size;
+ } test_stream[] = {
+ {DXVAHD_STREAM_STATE_D3DFORMAT, sizeof(DXVAHD_STREAM_STATE_D3DFORMAT_DATA)},
+ {DXVAHD_STREAM_STATE_FRAME_FORMAT, sizeof(DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA)},
+ {DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE, sizeof(DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA)},
+ {DXVAHD_STREAM_STATE_OUTPUT_RATE, sizeof(DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA)},
+ {DXVAHD_STREAM_STATE_SOURCE_RECT, sizeof(DXVAHD_STREAM_STATE_SOURCE_RECT_DATA)},
+ {DXVAHD_STREAM_STATE_DESTINATION_RECT, sizeof(DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA)},
+ {DXVAHD_STREAM_STATE_ALPHA, sizeof(DXVAHD_STREAM_STATE_ALPHA_DATA)},
+ {DXVAHD_STREAM_STATE_PALETTE, sizeof(DXVAHD_STREAM_STATE_PALETTE_DATA)},
+ {DXVAHD_STREAM_STATE_LUMA_KEY, sizeof(DXVAHD_STREAM_STATE_LUMA_KEY_DATA)},
+ {DXVAHD_STREAM_STATE_ASPECT_RATIO, sizeof(DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA)},
+ {DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
+ {DXVAHD_STREAM_STATE_FILTER_CONTRAST, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
+ {DXVAHD_STREAM_STATE_FILTER_HUE, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
+ {DXVAHD_STREAM_STATE_FILTER_SATURATION, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
+ {DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
+ {DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
+ {DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING, sizeof(DXVAHD_STREAM_STATE_FILTER_DATA)},
+ };
+
+ init_desc(&desc);
+ DXVAHD_CreateDevice(d3d_device, &desc, DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &device);
+ IDXVAHD_Device_GetVideoProcessorDeviceCaps(device, &caps);
+ input_formats = heap_alloc_zero(caps.InputFormatCount * sizeof(*input_formats));
+ vp_caps = heap_alloc_zero(caps.VideoProcessorCount * sizeof(*vp_caps));
+ IDXVAHD_Device_GetVideoProcessorCaps(device, caps.VideoProcessorCount, vp_caps);
+
+ hr = IDXVAHD_Device_CreateVideoProcessor(device, &vp_caps[0].VPGuid, &processor);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ for (i = 0; i < ARRAY_SIZE(test_blt); i++)
+ {
+ hr = IDXVAHD_VideoProcessor_GetVideoProcessBltState(processor, test_blt[i].state, test_blt[i].size, data);
+ ok(hr == S_OK, "Unexpected hr %#x for blt state %#x.\n", hr, test_blt[i].state);
+ /* Pass wrong data size for state */
+ hr = IDXVAHD_VideoProcessor_GetVideoProcessBltState(processor, test_blt[i].state, 64, data);
+ todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x for blt state %#x.\n", hr, test_blt[i].state);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(test_stream); i++)
+ {
+ hr = IDXVAHD_VideoProcessor_GetVideoProcessStreamState(processor, 0, test_stream[i].state, test_stream[i].size, data);
+ ok(hr == S_OK, "Unexpected hr %#x for stream state %#x.\n", hr, test_stream[i].state);
+ /* Pass wrong data size for state */
+ hr = IDXVAHD_VideoProcessor_GetVideoProcessStreamState(processor, 0, test_stream[i].state, 64, data);
+ todo_wine ok(hr == E_INVALIDARG, "Unexpected hr %#x for stream state %#x.\n", hr, test_stream[i].state);
+ }
+
+ IDXVAHD_VideoProcessor_Release(processor);
+
+ heap_free(data);
+ heap_free(input_formats);
+ heap_free(vp_caps);
+ IDXVAHD_Device_Release(device);
+}
+
+START_TEST(dxvahd)
+{
+ IDXVAHD_Device *device = NULL;
+ IDirect3D9Ex *d3d;
+ HWND window;
+ HRESULT hr;
+ DXVAHD_CONTENT_DESC desc = {0};
+
+ hr = Direct3DCreate9Ex(D3D_SDK_VERSION, &d3d);
+ if (hr != S_OK)
+ {
+ skip("Failed to create a D3D object, skipping tests.\n");
+ return;
+ }
+
+ window = create_window();
+
+ if (!(d3d_device = create_device(d3d, window)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+ }
+
+ init_desc(&desc);
+ hr = DXVAHD_CreateDevice(d3d_device, &desc, DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL, NULL, &device);
+ if (hr == E_NOINTERFACE)
+ {
+ skip("Device does not support DXVA-HD, skipping tests.\n");
+ goto done;
+ }
+ IDXVAHD_Device_Release(device);
+
+ test_dxvahd_device();
+ test_dxvahd_processor();
+
+done:
+ IDirect3DDevice9_Release(d3d_device);
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+}
diff --git a/include/Makefile.in b/include/Makefile.in
index 216adf0d7ae..f986ef42dd5 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -268,6 +268,7 @@ SOURCES = \
dxgitype.idl \
dxva.h \
dxva2api.idl \
+ dxvahd.idl \
dyngraph.idl \
endpointvolume.idl \
errorrep.h \
diff --git a/include/dxvahd.idl b/include/dxvahd.idl
new file mode 100644
index 00000000000..b6ed6b3217c
--- /dev/null
+++ b/include/dxvahd.idl
@@ -0,0 +1,473 @@
+/*
+ * Copyright 2020 Jeff Smith
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+import "unknwn.idl";
+
+cpp_quote("#if 0")
+interface IDirect3DDevice9Ex;
+interface IDirect3DSurface9;
+
+typedef DWORD D3DFORMAT;
+typedef DWORD D3DPOOL;
+typedef DWORD D3DCOLOR;
+cpp_quote("#endif")
+
+
+typedef enum _DXVAHD_FRAME_FORMAT
+{
+ DXVAHD_FRAME_FORMAT_PROGRESSIVE = 0,
+ DXVAHD_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1,
+ DXVAHD_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2
+} DXVAHD_FRAME_FORMAT;
+
+typedef enum _DXVAHD_DEVICE_USAGE
+{
+ DXVAHD_DEVICE_USAGE_PLAYBACK_NORMAL = 0,
+ DXVAHD_DEVICE_USAGE_OPTIMAL_SPEED = 1,
+ DXVAHD_DEVICE_USAGE_OPTIMAL_QUALITY = 2
+} DXVAHD_DEVICE_USAGE;
+
+typedef enum _DXVAHD_FILTER
+{
+ DXVAHD_FILTER_BRIGHTNESS = 0,
+ DXVAHD_FILTER_CONTRAST = 1,
+ DXVAHD_FILTER_HUE = 2,
+ DXVAHD_FILTER_SATURATION = 3,
+ DXVAHD_FILTER_NOISE_REDUCTION = 4,
+ DXVAHD_FILTER_EDGE_ENHANCEMENT = 5,
+ DXVAHD_FILTER_ANAMORPHIC_SCALING = 6
+} DXVAHD_FILTER;
+
+typedef enum _DXVAHD_SURFACE_TYPE
+{
+ DXVAHD_SURFACE_TYPE_VIDEO_INPUT = 0,
+ DXVAHD_SURFACE_TYPE_VIDEO_INPUT_PRIVATE = 1,
+ DXVAHD_SURFACE_TYPE_VIDEO_OUTPUT = 2
+} DXVAHD_SURFACE_TYPE;
+
+typedef enum _DXVAHD_BLT_STATE
+{
+ DXVAHD_BLT_STATE_TARGET_RECT = 0,
+ DXVAHD_BLT_STATE_BACKGROUND_COLOR = 1,
+ DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE = 2,
+ DXVAHD_BLT_STATE_ALPHA_FILL = 3,
+ DXVAHD_BLT_STATE_CONSTRICTION = 4,
+ DXVAHD_BLT_STATE_PRIVATE = 1000
+} DXVAHD_BLT_STATE;
+
+typedef enum _DXVAHD_STREAM_STATE
+{
+ DXVAHD_STREAM_STATE_D3DFORMAT = 0,
+ DXVAHD_STREAM_STATE_FRAME_FORMAT = 1,
+ DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE = 2,
+ DXVAHD_STREAM_STATE_OUTPUT_RATE = 3,
+ DXVAHD_STREAM_STATE_SOURCE_RECT = 4,
+ DXVAHD_STREAM_STATE_DESTINATION_RECT = 5,
+ DXVAHD_STREAM_STATE_ALPHA = 6,
+ DXVAHD_STREAM_STATE_PALETTE = 7,
+ DXVAHD_STREAM_STATE_LUMA_KEY = 8,
+ DXVAHD_STREAM_STATE_ASPECT_RATIO = 9,
+ DXVAHD_STREAM_STATE_FILTER_BRIGHTNESS = 100,
+ DXVAHD_STREAM_STATE_FILTER_CONTRAST = 101,
+ DXVAHD_STREAM_STATE_FILTER_HUE = 102,
+ DXVAHD_STREAM_STATE_FILTER_SATURATION = 103,
+ DXVAHD_STREAM_STATE_FILTER_NOISE_REDUCTION = 104,
+ DXVAHD_STREAM_STATE_FILTER_EDGE_ENHANCEMENT = 105,
+ DXVAHD_STREAM_STATE_FILTER_ANAMORPHIC_SCALING = 106,
+ DXVAHD_STREAM_STATE_PRIVATE = 1000
+} DXVAHD_STREAM_STATE;
+
+typedef enum _DXVAHD_DEVICE_TYPE
+{
+ DXVAHD_DEVICE_TYPE_HARDWARE = 0,
+ DXVAHD_DEVICE_TYPE_SOFTWARE = 1,
+ DXVAHD_DEVICE_TYPE_REFERENCE = 2,
+ DXVAHD_DEVICE_TYPE_OTHER = 3
+} DXVAHD_DEVICE_TYPE;
+
+typedef enum _DXVAHD_DEVICE_CAPS
+{
+ DXVAHD_DEVICE_CAPS_LINEAR_SPACE = 0x01,
+ DXVAHD_DEVICE_CAPS_xvYCC = 0x02,
+ DXVAHD_DEVICE_CAPS_RGB_RANGE_CONVERSION = 0x04,
+ DXVAHD_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = 0x08
+ // Based on DDI, Windows 8.1 should support:
+ // ..._NOMINAL_RANGE = 0x10
+
+} DXVAHD_DEVICE_CAPS;
+
+typedef enum _DXVAHD_FEATURE_CAPS
+{
+ DXVAHD_FEATURE_CAPS_ALPHA_FILL = 0x01,
+ DXVAHD_FEATURE_CAPS_CONSTRICTION = 0x02,
+ DXVAHD_FEATURE_CAPS_LUMA_KEY = 0x04,
+ DXVAHD_FEATURE_CAPS_ALPHA_PALETTE = 0x08
+ // Based on DDI, Windows 8 should support:
+ // ..._ROTATION = 0x10
+} DXVAHD_FEATURE_CAPS;
+
+typedef enum _DXVAHD_FILTER_CAPS
+{
+ DXVAHD_FILTER_CAPS_BRIGHTNESS = 0x01,
+ DXVAHD_FILTER_CAPS_CONTRAST = 0x02,
+ DXVAHD_FILTER_CAPS_HUE = 0x04,
+ DXVAHD_FILTER_CAPS_SATURATION = 0x08,
+ DXVAHD_FILTER_CAPS_NOISE_REDUCTION = 0x10,
+ DXVAHD_FILTER_CAPS_EDGE_ENHANCEMENT = 0x20,
+ DXVAHD_FILTER_CAPS_ANAMORPHIC_SCALING = 0x40
+} DXVAHD_FILTER_CAPS;
+
+typedef enum _DXVAHD_INPUT_FORMAT_CAPS
+{
+ DXVAHD_INPUT_FORMAT_CAPS_RGB_INTERLACED = 0x01,
+ DXVAHD_INPUT_FORMAT_CAPS_RGB_PROCAMP = 0x02,
+ DXVAHD_INPUT_FORMAT_CAPS_RGB_LUMA_KEY = 0x04,
+ DXVAHD_INPUT_FORMAT_CAPS_PALETTE_INTERLACED = 0x08
+} DXVAHD_INPUT_FORMAT_CAPS;
+
+typedef enum _DXVAHD_ALPHA_FILL_MODE
+{
+ DXVAHD_ALPHA_FILL_MODE_OPAQUE = 0,
+ DXVAHD_ALPHA_FILL_MODE_BACKGROUND = 1,
+ DXVAHD_ALPHA_FILL_MODE_DESTINATION = 2,
+ DXVAHD_ALPHA_FILL_MODE_SOURCE_STREAM = 3
+} DXVAHD_ALPHA_FILL_MODE;
+
+typedef enum _DXVAHD_OUTPUT_RATE
+{
+ DXVAHD_OUTPUT_RATE_NORMAL = 0,
+ DXVAHD_OUTPUT_RATE_HALF = 1,
+ DXVAHD_OUTPUT_RATE_CUSTOM = 2
+} DXVAHD_OUTPUT_RATE;
+
+
+typedef struct _DXVAHD_RATIONAL
+{
+ UINT Numerator;
+ UINT Denominator;
+} DXVAHD_RATIONAL;
+
+typedef struct _DXVAHD_CONTENT_DESC
+{
+ DXVAHD_FRAME_FORMAT InputFrameFormat;
+ DXVAHD_RATIONAL InputFrameRate;
+ UINT InputWidth;
+ UINT InputHeight;
+ DXVAHD_RATIONAL OutputFrameRate;
+ UINT OutputWidth;
+ UINT OutputHeight;
+} DXVAHD_CONTENT_DESC;
+
+typedef struct _DXVAHD_VPCAPS
+{
+ GUID VPGuid;
+ UINT PastFrames;
+ UINT FutureFrames;
+ UINT ProcessorCaps;
+ UINT ITelecineCaps;
+ UINT CustomRateCount;
+} DXVAHD_VPCAPS;
+
+typedef struct _DXVAHD_CUSTOM_RATE_DATA
+{
+ DXVAHD_RATIONAL CustomRate;
+ UINT OutputFrames;
+ BOOL InputInterlaced;
+ UINT InputFramesOrFields;
+} DXVAHD_CUSTOM_RATE_DATA;
+
+typedef struct _DXVAHD_FILTER_RANGE_DATA
+{
+ INT Minimum;
+ INT Maximum;
+ INT Default;
+ FLOAT Multiplier;
+} DXVAHD_FILTER_RANGE_DATA;
+
+typedef struct _DXVAHD_VPDEVCAPS
+{
+ DXVAHD_DEVICE_TYPE DeviceType;
+ UINT DeviceCaps;
+ UINT FeatureCaps;
+ UINT FilterCaps;
+ UINT InputFormatCaps;
+ D3DPOOL InputPool;
+ UINT OutputFormatCount;
+ UINT InputFormatCount;
+ UINT VideoProcessorCount;
+ UINT MaxInputStreams;
+ UINT MaxStreamStates;
+} DXVAHD_VPDEVCAPS;
+
+typedef struct _DXVAHD_STREAM_DATA
+{
+ BOOL Enable;
+ UINT OutputIndex;
+ UINT InputFrameOrField;
+ UINT PastFrames;
+ UINT FutureFrames;
+ IDirect3DSurface9 **ppPastSurfaces;
+ IDirect3DSurface9 *pInputSurface;
+ IDirect3DSurface9 **ppFutureSurfaces;
+} DXVAHD_STREAM_DATA;
+
+typedef struct _DXVAHD_BLT_STATE_TARGET_RECT_DATA
+{
+ BOOL Enable;
+ RECT TargetRect;
+} DXVAHD_BLT_STATE_TARGET_RECT_DATA;
+
+typedef struct _DXVAHD_COLOR_RGBA
+{
+ FLOAT R;
+ FLOAT G;
+ FLOAT B;
+ FLOAT A;
+} DXVAHD_COLOR_RGBA;
+
+typedef struct _DXVAHD_COLOR_YCbCrA
+{
+ FLOAT Y;
+ FLOAT Cb;
+ FLOAT Cr;
+ FLOAT A;
+} DXVAHD_COLOR_YCbCrA;
+
+typedef union _DXVAHD_COLOR
+{
+ DXVAHD_COLOR_RGBA RGB;
+ DXVAHD_COLOR_YCbCrA YCbCr;
+} DXVAHD_COLOR;
+
+typedef struct _DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA
+{
+ BOOL YCbCr;
+ DXVAHD_COLOR BackgroundColor;
+} DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA;
+
+typedef struct _DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA
+{
+ union
+ {
+ struct
+ {
+ UINT Usage : 1;
+ UINT RGB_Range : 1;
+ UINT YCbCr_Matrix : 1;
+ UINT YCbCr_xvYCC : 1;
+ UINT Reserved : 28;
+ };
+ UINT Value;
+ };
+} DXVAHD_BLT_STATE_OUTPUT_COLOR_SPACE_DATA;
+
+typedef struct _DXVAHD_BLT_STATE_ALPHA_FILL_DATA
+{
+ DXVAHD_ALPHA_FILL_MODE Mode;
+ UINT StreamNumber;
+} DXVAHD_BLT_STATE_ALPHA_FILL_DATA;
+
+typedef struct _DXVAHD_BLT_STATE_CONSTRICTION_DATA
+{
+ BOOL Enable;
+ SIZE Size;
+} DXVAHD_BLT_STATE_CONSTRICTION_DATA;
+
+typedef struct _DXVAHD_BLT_STATE_PRIVATE_DATA
+{
+ GUID Guid;
+ UINT DataSize;
+ void *pData;
+} DXVAHD_BLT_STATE_PRIVATE_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_D3DFORMAT_DATA
+{
+ D3DFORMAT Format;
+} DXVAHD_STREAM_STATE_D3DFORMAT_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA
+{
+ DXVAHD_FRAME_FORMAT FrameFormat;
+} DXVAHD_STREAM_STATE_FRAME_FORMAT_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA
+{
+ union
+ {
+ struct
+ {
+ UINT Type : 1;
+ UINT RGB_Range : 1;
+ UINT YCbCr_Matrix : 1;
+ UINT YCbCr_xvYCC : 1;
+ UINT Reserved : 28;
+ };
+ UINT Value;
+ };
+} DXVAHD_STREAM_STATE_INPUT_COLOR_SPACE_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA
+{
+ BOOL RepeatFrame;
+ DXVAHD_OUTPUT_RATE OutputRate;
+ DXVAHD_RATIONAL CustomRate;
+} DXVAHD_STREAM_STATE_OUTPUT_RATE_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_SOURCE_RECT_DATA
+{
+ BOOL Enable;
+ RECT SourceRect;
+} DXVAHD_STREAM_STATE_SOURCE_RECT_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA
+{
+ BOOL Enable;
+ RECT DestinationRect;
+} DXVAHD_STREAM_STATE_DESTINATION_RECT_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_ALPHA_DATA
+{
+ BOOL Enable;
+ FLOAT Alpha;
+} DXVAHD_STREAM_STATE_ALPHA_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_PALETTE_DATA
+{
+ UINT Count;
+ D3DCOLOR *pEntries;
+} DXVAHD_STREAM_STATE_PALETTE_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_LUMA_KEY_DATA
+{
+ BOOL Enable;
+ FLOAT Lower;
+ FLOAT Upper;
+} DXVAHD_STREAM_STATE_LUMA_KEY_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA
+{
+ BOOL Enable;
+ DXVAHD_RATIONAL SourceAspectRatio;
+ DXVAHD_RATIONAL DestinationAspectRatio;
+} DXVAHD_STREAM_STATE_ASPECT_RATIO_DATA;
+
+typedef struct _DXVAHD_STREAM_STATE_FILTER_DATA
+{
+ BOOL Enable;
+ INT Level;
+} DXVAHD_STREAM_STATE_FILTER_DATA;
+
+
+// FIXME
+typedef void* PDXVAHDSW_Plugin;
+
+
+interface IDXVAHD_Device;
+interface IDXVAHD_VideoProcessor;
+
+cpp_quote("HRESULT WINAPI DXVAHD_CreateDevice(IDirect3DDevice9Ex *d3d_device, const DXVAHD_CONTENT_DESC *desc, DXVAHD_DEVICE_USAGE usage, PDXVAHDSW_Plugin plugin, IDXVAHD_Device **device);")
+
+/*****************************************************************************
+ * IDXVAHD_Device interface
+ */
+[
+ object,
+ uuid(95f12dfd-d77e-49be-815f-57d579634d6d),
+ local
+]
+interface IDXVAHD_Device : IUnknown
+{
+ HRESULT CreateVideoSurface(
+ [in] UINT width,
+ [in] UINT height,
+ [in] D3DFORMAT format,
+ [in] D3DPOOL pool,
+ [in] DWORD usage,
+ [in] DXVAHD_SURFACE_TYPE type,
+ [in] UINT num_surfaces,
+ [out] IDirect3DSurface9 **ppSurface,
+ [in, out] HANDLE *pSharedHandle);
+
+ HRESULT GetVideoProcessorDeviceCaps(
+ [out] DXVAHD_VPDEVCAPS *pCaps);
+
+ HRESULT GetVideoProcessorOutputFormats(
+ [in] UINT count,
+ [out] D3DFORMAT *pFormats);
+
+ HRESULT GetVideoProcessorInputFormats(
+ [in] UINT count,
+ [out] D3DFORMAT *pFormats);
+
+ HRESULT GetVideoProcessorCaps(
+ [in] UINT count,
+ [out] DXVAHD_VPCAPS *pCaps);
+
+ HRESULT GetVideoProcessorCustomRates(
+ [in] const GUID *pVPGuid,
+ [in] UINT count,
+ [out] DXVAHD_CUSTOM_RATE_DATA *pRates);
+
+ HRESULT GetVideoProcessorFilterRange(
+ [in] DXVAHD_FILTER filter,
+ [out] DXVAHD_FILTER_RANGE_DATA *pRange);
+
+ HRESULT CreateVideoProcessor(
+ [in] const GUID *pVPGuid,
+ [out] IDXVAHD_VideoProcessor **ppVideoProcessor);
+}
+
+
+/*****************************************************************************
+ * IDXVAHD_VideoProcessor interface
+ */
+[
+ object,
+ uuid(95f4edf4-6e03-4cd7-be1b-3075d665aa52),
+ local
+]
+interface IDXVAHD_VideoProcessor : IUnknown
+{
+ HRESULT SetVideoProcessBltState(
+ [in] DXVAHD_BLT_STATE State,
+ [in] UINT DataSize,
+ [in] const void *pData);
+
+ HRESULT GetVideoProcessBltState(
+ [in] DXVAHD_BLT_STATE State,
+ [in] UINT DataSize,
+ [out] void *pData);
+
+ HRESULT SetVideoProcessStreamState(
+ [in] UINT StreamNumber,
+ [in] DXVAHD_STREAM_STATE State,
+ [in] UINT DataSize,
+ [in] const void *pData);
+
+ HRESULT GetVideoProcessStreamState(
+ [in] UINT StreamNumber,
+ [in] DXVAHD_STREAM_STATE State,
+ [in] UINT DataSize,
+ [out] void *pData);
+
+ HRESULT VideoProcessBltHD(
+ [in, out] IDirect3DSurface9 *pOutputSurface,
+ [in] UINT OutputFrame,
+ [in] UINT StreamCount,
+ [in] const DXVAHD_STREAM_DATA *pStreams);
+}
--
2.23.0
July 31, 2020
[PATCH vkd3d] include: Correct the case of rbtree macros.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
include/private/rbtree.h | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/private/rbtree.h b/include/private/rbtree.h
index 7f44a0e..b4993da 100644
--- a/include/private/rbtree.h
+++ b/include/private/rbtree.h
@@ -127,33 +127,33 @@ static inline struct rb_entry *rb_postorder_next(struct rb_entry *iter)
}
/* iterate through the tree */
-#define rb_FOR_EACH(cursor, tree) \
+#define RB_FOR_EACH(cursor, tree) \
for ((cursor) = rb_head((tree)->root); (cursor); (cursor) = rb_next(cursor))
/* iterate through the tree using a tree entry */
-#define rb_FOR_EACH_ENTRY(elem, tree, type, field) \
- for ((elem) = rb_ENTRY_VALUE(rb_head((tree)->root), type, field); \
+#define RB_FOR_EACH_ENTRY(elem, tree, type, field) \
+ for ((elem) = RB_ENTRY_VALUE(rb_head((tree)->root), type, field); \
&(elem)->field; \
- (elem) = rb_ENTRY_VALUE(rb_next(&elem->field), type, field))
+ (elem) = RB_ENTRY_VALUE(rb_next(&elem->field), type, field))
/* iterate through the tree using using postorder, making it safe to free the entry */
-#define rb_FOR_EACH_DESTRUCTOR(cursor, cursor2, tree) \
+#define RB_FOR_EACH_DESTRUCTOR(cursor, cursor2, tree) \
for ((cursor) = rb_postorder_head((tree)->root); \
(cursor) && (((cursor2) = rb_postorder_next(cursor)) || 1); \
(cursor) = (cursor2))
/* iterate through the tree using a tree entry and postorder, making it safe to free the entry */
-#define rb_FOR_EACH_ENTRY_DESTRUCTOR(elem, elem2, tree, type, field) \
- for ((elem) = rb_ENTRY_VALUE(rb_postorder_head((tree)->root), type, field); \
+#define RB_FOR_EACH_ENTRY_DESTRUCTOR(elem, elem2, tree, type, field) \
+ for ((elem) = RB_ENTRY_VALUE(rb_postorder_head((tree)->root), type, field); \
&(elem)->field \
- && (((elem2) = rb_ENTRY_VALUE(rb_postorder_next(&(elem)->field), type, field)) || 1); \
+ && (((elem2) = RB_ENTRY_VALUE(rb_postorder_next(&(elem)->field), type, field)) || 1); \
(elem) = (elem2))
static inline void rb_postorder(struct rb_tree *tree, rb_traverse_func *callback, void *context)
{
struct rb_entry *iter, *next;
- rb_FOR_EACH_DESTRUCTOR(iter, next, tree) callback(iter, context);
+ RB_FOR_EACH_DESTRUCTOR(iter, next, tree) callback(iter, context);
}
static inline void rb_init(struct rb_tree *tree, rb_compare_func compare)
@@ -165,7 +165,7 @@ static inline void rb_init(struct rb_tree *tree, rb_compare_func compare)
static inline void rb_for_each_entry(struct rb_tree *tree, rb_traverse_func *callback, void *context)
{
struct rb_entry *iter;
- rb_FOR_EACH(iter, tree) callback(iter, context);
+ RB_FOR_EACH(iter, tree) callback(iter, context);
}
static inline void rb_clear(struct rb_tree *tree, rb_traverse_func *callback, void *context)
--
2.27.0
July 31, 2020
Re: [EXTERNAL] [PATCH 2/2] ntdll: Move InterlockedCompareExchange128 support to winnt.h.
by Jacek Caban
On 31.07.2020 17:01, Puetz Kevin A wrote:
> There's no __sync_bool_compare_and_swap_16 in ARMv8.0
> (or even with ARMv8.1, support wasn't added until until GCC 10).
>
> This of course broke our builds when it was added; for now I'd been working
> around it with the attached patch, which substitutes the -latomic
> __atomic_compare_exchange_16, which is allowed to be based on a lock
> if there's no lockfree implementation (e.g. the specified -march or GCC lack
> support for the ARMv8.1 CASP* instructions).
>
> I was waiting to hear back from our BSP guys whether we'd eventually get
> support on the final hardware/toolchain or not before raising this upstream,
> to see know if I had an issue that needed a "real" fix or just a short-term
> impediment (in which case I had a viable workaround in the meantime).
>
> But if you're moving it into external API too, then it seems like it's time to at
> least point out what I've learned.
>
> Microsoft only promises InterlockedCompareExchange128 on amd64;
> It's nice to offer it anywhere an underlying compiler intrinsic exists, but
> that needs to test defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16).
> And I think RtlInterlocked*SList needs some kind of fallback.
> What I did with -latomic seems sane, but should get a ./configure check
> since you wouldn't need to link -latomic if the compiler has the intrinsic.
Oh, I see, I didn't know it's already broken on aarch64. FWIW, I just
wanted to fix a warning on clang msvcrt target and while doing that, I
generalized the solution. We can wait with that for aarch64 solution.
Depending on -latomic may be problematic in PE builds. If I read
libatomic source right, libatomic resorts to using lock in this case
(pthread_mutex_lock or equivalent, depending on host). We could probably
just add a variant of affected RtlInterlocked*SList* functions that
would use critical section instead of interlocked operations.
Thanks,
Jacek
July 31, 2020
Re: [PATCH v2] winevulkan: Avoid returning 0 for swapchain maxImageCount.
by Joshua Ashton
Signed-off-by: Joshua Ashton <joshua(a)froggi.es>
On 31/07/2020 10:48, Liam Middlebrook wrote:
> Signed-off-by: Liam Middlebrook <lmiddlebrook(a)nvidia.com>
>
> On 7/31/20 2:13 AM, Georg Lehmann wrote:
>> Many Windows games do not expect that maxImageCount can be set to 0.
>> A value of 0 means that there is no limit on the number of images.
>> Nvidia reports 8 on Windows, AMD 16.
>>
>> Based on a patch by Józef Kucia.
>>
>> Signed-off-by: Georg Lehmann <dadschoorse(a)gmail.com>
>> ---
>> dlls/winevulkan/make_vulkan | 4 +--
>> dlls/winevulkan/vulkan.c | 47 ++++++++++++++++++++++++++++++++
>> dlls/winevulkan/vulkan_private.h | 1 +
>> dlls/winevulkan/vulkan_thunks.c | 8 ++----
>> dlls/winevulkan/vulkan_thunks.h | 4 +++
>> 5 files changed, 56 insertions(+), 8 deletions(-)
>>
>> diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
>> index fc0e2182dd..6a039bd268 100755
>> --- a/dlls/winevulkan/make_vulkan
>> +++ b/dlls/winevulkan/make_vulkan
>> @@ -183,12 +183,12 @@ FUNCTION_OVERRIDES = {
>> # VK_KHR_surface
>> "vkDestroySurfaceKHR" : {"dispatch" : True, "driver" : True,
>> "thunk" : True},
>> "vkGetPhysicalDeviceSurfaceSupportKHR" : {"dispatch" : True,
>> "driver" : True, "thunk" : True},
>> - "vkGetPhysicalDeviceSurfaceCapabilitiesKHR" : {"dispatch" : True,
>> "driver" : True, "thunk" : True},
>> + "vkGetPhysicalDeviceSurfaceCapabilitiesKHR" : {"dispatch" : True,
>> "driver" : True, "thunk" : False, "private_thunk" : True},
>> "vkGetPhysicalDeviceSurfaceFormatsKHR" : {"dispatch" : True,
>> "driver" : True, "thunk" : True},
>> "vkGetPhysicalDeviceSurfacePresentModesKHR" : {"dispatch" :
>> True, "driver" : True, "thunk" : True},
>> # VK_KHR_get_surface_capabilities2
>> - "vkGetPhysicalDeviceSurfaceCapabilities2KHR" : {"dispatch" :
>> True, "driver" : True, "thunk" : True},
>> + "vkGetPhysicalDeviceSurfaceCapabilities2KHR" : {"dispatch" :
>> True, "driver" : True, "thunk" : False, "private_thunk" : True},
>> "vkGetPhysicalDeviceSurfaceFormats2KHR" : {"dispatch" : True,
>> "driver" : True, "thunk" : True},
>> # VK_KHR_win32_surface
>> diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
>> index be614f1cef..5f8046f1ba 100644
>> --- a/dlls/winevulkan/vulkan.c
>> +++ b/dlls/winevulkan/vulkan.c
>> @@ -723,6 +723,8 @@ VkResult WINAPI wine_vkCreateInstance(const
>> VkInstanceCreateInfo *create_info,
>> object->quirks |= WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR;
>> }
>> + object->quirks |= WINEVULKAN_QUIRK_ADJUST_MAX_IMAGE_COUNT;
>> +
>> *instance = object;
>> TRACE("Created instance %p (native instance %p).\n", object,
>> object->instance);
>> return VK_SUCCESS;
>> @@ -1555,6 +1557,51 @@ void WINAPI wine_vkGetPrivateDataEXT(VkDevice
>> device, VkObjectType object_type,
>> device->funcs.p_vkGetPrivateDataEXT(device->device, object_type,
>> object_handle, private_data_slot, data);
>> }
>> +static inline void adjust_max_image_count(VkPhysicalDevice phys_dev,
>> VkSurfaceCapabilitiesKHR* capabilities)
>> +{
>> + /* Many Windows games, for example Strange Brigade, No Man's Sky,
>> Path of Exile
>> + * and World War Z, do not expect that maxImageCount can be set
>> to 0.
>> + * A value of 0 means that there is no limit on the number of
>> images.
>> + * Nvidia reports 8 on Windows, AMD 16.
>> + * https://vulkan.gpuinfo.org/displayreport.php?id=9122#surface
>> + * https://vulkan.gpuinfo.org/displayreport.php?id=9121#surface
>> + */
>> + if ((phys_dev->instance->quirks &
>> WINEVULKAN_QUIRK_ADJUST_MAX_IMAGE_COUNT) && !capabilities->maxImageCount)
>> + {
>> + capabilities->maxImageCount =
>> max(capabilities->minImageCount, 16);
>> + }
>> +}
>> +
>> +VkResult WINAPI
>> wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice phys_dev,
>> + VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *capabilities)
>> +{
>> + VkResult res;
>> +
>> + TRACE("%p, 0x%s, %p\n", phys_dev, wine_dbgstr_longlong(surface),
>> capabilities);
>> +
>> + res = thunk_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev,
>> surface, capabilities);
>> +
>> + if (res == VK_SUCCESS)
>> + adjust_max_image_count(phys_dev, capabilities);
>> +
>> + return res;
>> +}
>> +
>> +VkResult WINAPI
>> wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice
>> phys_dev,
>> + const VkPhysicalDeviceSurfaceInfo2KHR *surface_info,
>> VkSurfaceCapabilities2KHR *capabilities)
>> +{
>> + VkResult res;
>> +
>> + TRACE("%p, %p, %p\n", phys_dev, surface_info, capabilities);
>> +
>> + res = thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(phys_dev,
>> surface_info, capabilities);
>> +
>> + if (res == VK_SUCCESS)
>> + adjust_max_image_count(phys_dev,
>> &capabilities->surfaceCapabilities);
>> +
>> + return res;
>> +}
>> +
>> BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved)
>> {
>> TRACE("%p, %u, %p\n", hinst, reason, reserved);
>> diff --git a/dlls/winevulkan/vulkan_private.h
>> b/dlls/winevulkan/vulkan_private.h
>> index 17072d2341..b048108f7a 100644
>> --- a/dlls/winevulkan/vulkan_private.h
>> +++ b/dlls/winevulkan/vulkan_private.h
>> @@ -38,6 +38,7 @@
>> #define VULKAN_ICD_MAGIC_VALUE 0x01CDC0DE
>> #define WINEVULKAN_QUIRK_GET_DEVICE_PROC_ADDR 0x00000001
>> +#define WINEVULKAN_QUIRK_ADJUST_MAX_IMAGE_COUNT 0x00000002
>> struct vulkan_func
>> {
>> diff --git a/dlls/winevulkan/vulkan_thunks.c
>> b/dlls/winevulkan/vulkan_thunks.c
>> index fcefa6a767..4f75a4ec7c 100644
>> --- a/dlls/winevulkan/vulkan_thunks.c
>> +++ b/dlls/winevulkan/vulkan_thunks.c
>> @@ -4998,26 +4998,22 @@ static VkResult WINAPI
>> wine_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesC
>> return
>> physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV(physicalDevice->phys_dev,
>> pCombinationCount, pCombinations);
>> }
>> -VkResult WINAPI
>> wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice
>> physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
>> VkSurfaceCapabilities2KHR *pSurfaceCapabilities)
>> +VkResult
>> thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice
>> physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
>> VkSurfaceCapabilities2KHR *pSurfaceCapabilities)
>> {
>> #if defined(USE_STRUCT_CONVERSION)
>> VkResult result;
>> VkPhysicalDeviceSurfaceInfo2KHR_host pSurfaceInfo_host;
>> - TRACE("%p, %p, %p\n", physicalDevice, pSurfaceInfo,
>> pSurfaceCapabilities);
>> -
>>
>> convert_VkPhysicalDeviceSurfaceInfo2KHR_win_to_host(pSurfaceInfo,
>> &pSurfaceInfo_host);
>> result =
>> physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice->phys_dev,
>> &pSurfaceInfo_host, pSurfaceCapabilities);
>> return result;
>> #else
>> - TRACE("%p, %p, %p\n", physicalDevice, pSurfaceInfo,
>> pSurfaceCapabilities);
>> return
>> physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice->phys_dev,
>> pSurfaceInfo, pSurfaceCapabilities);
>> #endif
>> }
>> -VkResult WINAPI
>> wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice
>> physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR
>> *pSurfaceCapabilities)
>> +VkResult
>> thunk_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice
>> physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR
>> *pSurfaceCapabilities)
>> {
>> - TRACE("%p, 0x%s, %p\n", physicalDevice,
>> wine_dbgstr_longlong(surface), pSurfaceCapabilities);
>> return
>> physicalDevice->instance->funcs.p_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice->phys_dev,
>> surface, pSurfaceCapabilities);
>> }
>> diff --git a/dlls/winevulkan/vulkan_thunks.h
>> b/dlls/winevulkan/vulkan_thunks.h
>> index f2d650decf..d35e8c4269 100644
>> --- a/dlls/winevulkan/vulkan_thunks.h
>> +++ b/dlls/winevulkan/vulkan_thunks.h
>> @@ -42,6 +42,8 @@ VkResult WINAPI
>> wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice
>> VkResult WINAPI
>> wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice
>> physicalDevice, const VkPhysicalDeviceImageFormatInfo2
>> *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties)
>> DECLSPEC_HIDDEN;
>> void WINAPI wine_vkGetPhysicalDeviceProperties2(VkPhysicalDevice
>> physicalDevice, VkPhysicalDeviceProperties2 *pProperties);
>> void WINAPI wine_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice
>> physicalDevice, VkPhysicalDeviceProperties2 *pProperties)
>> DECLSPEC_HIDDEN;
>> +VkResult WINAPI
>> wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice
>> physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
>> VkSurfaceCapabilities2KHR *pSurfaceCapabilities);
>> +VkResult WINAPI
>> wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice
>> physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR
>> *pSurfaceCapabilities);
>> void WINAPI wine_vkGetPrivateDataEXT(VkDevice device, VkObjectType
>> objectType, uint64_t objectHandle, VkPrivateDataSlotEXT
>> privateDataSlot, uint64_t *pData) DECLSPEC_HIDDEN;
>> VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t
>> submitCount, const VkSubmitInfo *pSubmits, VkFence fence);
>> VkResult WINAPI wine_vkSetPrivateDataEXT(VkDevice device,
>> VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT
>> privateDataSlot, uint64_t data) DECLSPEC_HIDDEN;
>> @@ -51,6 +53,8 @@ VkResult
>> thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physic
>> VkResult
>> thunk_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice
>> physicalDevice, const VkPhysicalDeviceImageFormatInfo2
>> *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties)
>> DECLSPEC_HIDDEN;
>> void thunk_vkGetPhysicalDeviceProperties2(VkPhysicalDevice
>> physicalDevice, VkPhysicalDeviceProperties2 *pProperties)
>> DECLSPEC_HIDDEN;
>> void thunk_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice
>> physicalDevice, VkPhysicalDeviceProperties2 *pProperties)
>> DECLSPEC_HIDDEN;
>> +VkResult
>> thunk_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice
>> physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
>> VkSurfaceCapabilities2KHR *pSurfaceCapabilities) DECLSPEC_HIDDEN;
>> +VkResult
>> thunk_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice
>> physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR
>> *pSurfaceCapabilities) DECLSPEC_HIDDEN;
>> typedef struct VkAcquireNextImageInfoKHR_host
>> {
>>
>
July 31, 2020