dxgi: Implement dxgi_output_TakeOwnership().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4f3d66e2c6
commit
c173a650e1
|
@ -364,9 +364,22 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_WaitForVBlank(IDXGIOutput4 *iface)
|
|||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_output_TakeOwnership(IDXGIOutput4 *iface, IUnknown *device, BOOL exclusive)
|
||||
{
|
||||
FIXME("iface %p, device %p, exclusive %d stub!\n", iface, device, exclusive);
|
||||
struct dxgi_output *output = impl_from_IDXGIOutput4(iface);
|
||||
struct wined3d_output *wined3d_output;
|
||||
HRESULT hr = DXGI_ERROR_INVALID_CALL;
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("iface %p, device %p, exclusive %d.\n", iface, device, exclusive);
|
||||
|
||||
if (!device)
|
||||
return DXGI_ERROR_INVALID_CALL;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
if ((wined3d_output = wined3d_get_adapter_output(output->adapter->factory->wined3d,
|
||||
output->adapter->ordinal)))
|
||||
hr = wined3d_output_take_ownership(wined3d_output, exclusive);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static void STDMETHODCALLTYPE dxgi_output_ReleaseOwnership(IDXGIOutput4 *iface)
|
||||
|
|
|
@ -5611,10 +5611,14 @@ static void test_output_ownership(IUnknown *device, BOOL is_d3d12)
|
|||
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_SUCCESS, FALSE);
|
||||
else
|
||||
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_GRAPHICS_PRESENT_OCCLUDED, TRUE);
|
||||
hr = IDXGIOutput_TakeOwnership(output, NULL, FALSE);
|
||||
ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDXGIOutput_TakeOwnership(output, NULL, TRUE);
|
||||
ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDXGIOutput_TakeOwnership(output, device, FALSE);
|
||||
todo_wine ok(hr == (is_d3d12 ? E_NOINTERFACE : E_INVALIDARG), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDXGIOutput_TakeOwnership(output, device, TRUE);
|
||||
todo_wine ok(hr == (is_d3d12 ? E_NOINTERFACE : S_OK), "Got unexpected hr %#x.\n", hr);
|
||||
todo_wine_if(is_d3d12) ok(hr == (is_d3d12 ? E_NOINTERFACE : S_OK), "Got unexpected hr %#x.\n", hr);
|
||||
IDXGIOutput_ReleaseOwnership(output);
|
||||
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_SUCCESS, FALSE);
|
||||
|
||||
|
@ -5624,16 +5628,16 @@ static void test_output_ownership(IUnknown *device, BOOL is_d3d12)
|
|||
goto done;
|
||||
|
||||
hr = IDXGIOutput_TakeOwnership(output, device, FALSE);
|
||||
todo_wine ok(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE, "Got unexpected hr %#x.\n", hr);
|
||||
ok(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE, "Got unexpected hr %#x.\n", hr);
|
||||
IDXGIOutput_ReleaseOwnership(output);
|
||||
|
||||
hr = IDXGIOutput_TakeOwnership(output, device, TRUE);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
/* Note that the "exclusive" parameter to IDXGIOutput_TakeOwnership()
|
||||
* seems to behave opposite to what's described by MSDN. */
|
||||
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_GRAPHICS_PRESENT_OCCLUDED, TRUE);
|
||||
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_GRAPHICS_PRESENT_OCCLUDED, FALSE);
|
||||
hr = IDXGIOutput_TakeOwnership(output, device, FALSE);
|
||||
todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
|
||||
IDXGIOutput_ReleaseOwnership(output);
|
||||
|
||||
/* Swapchain in windowed mode. */
|
||||
|
@ -5646,11 +5650,11 @@ static void test_output_ownership(IUnknown *device, BOOL is_d3d12)
|
|||
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_SUCCESS, FALSE);
|
||||
|
||||
hr = IDXGIOutput_TakeOwnership(output, device, FALSE);
|
||||
todo_wine ok(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE, "Got unexpected hr %#x.\n", hr);
|
||||
ok(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDXGIOutput_TakeOwnership(output, device, TRUE);
|
||||
todo_wine ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_GRAPHICS_PRESENT_OCCLUDED, TRUE);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_GRAPHICS_PRESENT_OCCLUDED, FALSE);
|
||||
IDXGIOutput_ReleaseOwnership(output);
|
||||
wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_SUCCESS, FALSE);
|
||||
|
||||
|
|
|
@ -72,6 +72,37 @@ void CDECL wined3d_output_release_ownership(const struct wined3d_output *output)
|
|||
D3DKMTSetVidPnSourceOwner(&set_owner_desc);
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_output_take_ownership(const struct wined3d_output *output, BOOL exclusive)
|
||||
{
|
||||
D3DKMT_SETVIDPNSOURCEOWNER set_owner_desc;
|
||||
D3DKMT_VIDPNSOURCEOWNER_TYPE owner_type;
|
||||
NTSTATUS status;
|
||||
|
||||
TRACE("output %p, exclusive %#x.\n", output, exclusive);
|
||||
|
||||
owner_type = exclusive ? D3DKMT_VIDPNSOURCEOWNER_EXCLUSIVE : D3DKMT_VIDPNSOURCEOWNER_SHARED;
|
||||
set_owner_desc.pType = &owner_type;
|
||||
set_owner_desc.pVidPnSourceId = &output->vidpn_source_id;
|
||||
set_owner_desc.VidPnSourceCount = 1;
|
||||
set_owner_desc.hDevice = output->kmt_device;
|
||||
status = D3DKMTSetVidPnSourceOwner(&set_owner_desc);
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE:
|
||||
return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE;
|
||||
case STATUS_INVALID_PARAMETER:
|
||||
return E_INVALIDARG;
|
||||
case STATUS_PROCEDURE_NOT_FOUND:
|
||||
return E_NOINTERFACE;
|
||||
case STATUS_SUCCESS:
|
||||
return S_OK;
|
||||
default:
|
||||
FIXME("Unhandled error %#x.\n", status);
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
static void wined3d_output_cleanup(const struct wined3d_output *output)
|
||||
{
|
||||
D3DKMT_DESTROYDEVICE destroy_device_desc;
|
||||
|
|
|
@ -193,6 +193,7 @@
|
|||
@ cdecl wined3d_device_validate_device(ptr ptr)
|
||||
|
||||
@ cdecl wined3d_output_release_ownership(ptr)
|
||||
@ cdecl wined3d_output_take_ownership(ptr long)
|
||||
|
||||
@ cdecl wined3d_palette_create(ptr long long ptr ptr)
|
||||
@ cdecl wined3d_palette_decref(ptr)
|
||||
|
|
|
@ -2490,6 +2490,7 @@ HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device,
|
|||
HRESULT __cdecl wined3d_device_validate_device(const struct wined3d_device *device, DWORD *num_passes);
|
||||
|
||||
void __cdecl wined3d_output_release_ownership(const struct wined3d_output *output);
|
||||
HRESULT __cdecl wined3d_output_take_ownership(const struct wined3d_output *output, BOOL exclusive);
|
||||
|
||||
HRESULT __cdecl wined3d_palette_create(struct wined3d_device *device, DWORD flags,
|
||||
unsigned int entry_count, const PALETTEENTRY *entries, struct wined3d_palette **palette);
|
||||
|
|
Loading…
Reference in New Issue