Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/ddraw/ddraw.c | 13 ++++++++----- dlls/ddraw/ddraw_private.h | 1 + dlls/ddraw/surface.c | 6 ++++++ dlls/ddraw/tests/ddraw1.c | 2 +- dlls/ddraw/tests/ddraw2.c | 2 +- dlls/ddraw/tests/ddraw4.c | 2 +- dlls/ddraw/tests/ddraw7.c | 2 +- 7 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index c0c49dbab1e..8467fbf4ccc 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2266,21 +2266,24 @@ static HRESULT WINAPI ddraw4_TestCooperativeLevel(IDirectDraw4 *iface) * DDERR_NOTFOUND if the GDI surface wasn't found * *****************************************************************************/ -static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurface7 **GDISurface) +static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurface7 **surface) { struct ddraw *ddraw = impl_from_IDirectDraw7(iface); + struct ddraw_surface *ddraw_surface;
- TRACE("iface %p, surface %p.\n", iface, GDISurface); + TRACE("iface %p, surface %p.\n", iface, surface);
wined3d_mutex_lock();
- if (!(*GDISurface = &ddraw->primary->IDirectDrawSurface7_iface)) + if (!ddraw->gdi_surface || !(ddraw_surface = wined3d_texture_get_sub_resource_parent(ddraw->gdi_surface, 0))) { - WARN("Primary not created yet.\n"); + WARN("GDI surface not available.\n"); + *surface = NULL; wined3d_mutex_unlock(); return DDERR_NOTFOUND; } - IDirectDrawSurface7_AddRef(*GDISurface); + *surface = &ddraw_surface->IDirectDrawSurface7_iface; + IDirectDrawSurface7_AddRef(*surface);
wined3d_mutex_unlock();
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index b035a7e0509..77e28662724 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -97,6 +97,7 @@ struct ddraw struct ddraw_surface *primary; RECT primary_lock; struct wined3d_texture *wined3d_frontbuffer; + struct wined3d_texture *gdi_surface; struct wined3d_swapchain *wined3d_swapchain; HWND swapchain_window;
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 819044214d5..385ba1ac966 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -5800,7 +5800,10 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren IDirectDrawClipper_Release(&surface->clipper->IDirectDrawClipper_iface);
if (surface == surface->ddraw->primary) + { surface->ddraw->primary = NULL; + surface->ddraw->gdi_surface = NULL; + }
wined3d_private_store_cleanup(&surface->private_store);
@@ -6457,7 +6460,10 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ }
if (surface_desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) + { ddraw->primary = root; + ddraw->gdi_surface = root->wined3d_texture; + } *surface = root;
return DD_OK; diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 20ec3291c5c..cb6bffef7f9 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -12080,7 +12080,7 @@ static void test_gdi_surface(void) ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDraw_GetGDISurface(ddraw, &gdi_surface); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); - todo_wine ok(gdi_surface == backbuffer || broken(gdi_surface == primary), + ok(gdi_surface == backbuffer || broken(gdi_surface == primary), "Got unexpected surface %p, expected %p.\n", gdi_surface, backbuffer); IDirectDrawSurface_Release(gdi_surface);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 1e16f2be9c1..8a19327071d 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -13381,7 +13381,7 @@ static void test_gdi_surface(void) ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDraw2_GetGDISurface(ddraw, &gdi_surface); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); - todo_wine ok(gdi_surface == backbuffer || broken(gdi_surface == primary), + ok(gdi_surface == backbuffer || broken(gdi_surface == primary), "Got unexpected surface %p, expected %p.\n", gdi_surface, backbuffer); IDirectDrawSurface_Release(gdi_surface);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 6f9917643d2..b304863a38b 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -15586,7 +15586,7 @@ static void test_gdi_surface(void) ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDraw4_GetGDISurface(ddraw, &gdi_surface); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); - todo_wine ok(gdi_surface == backbuffer || broken(gdi_surface == primary), + ok(gdi_surface == backbuffer || broken(gdi_surface == primary), "Got unexpected surface %p, expected %p.\n", gdi_surface, backbuffer); IDirectDrawSurface4_Release(gdi_surface);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 21f8806999a..f5ec87ff395 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -15294,7 +15294,7 @@ static void test_gdi_surface(void) ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirectDraw7_GetGDISurface(ddraw, &gdi_surface); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); - todo_wine ok(gdi_surface == backbuffer || broken(gdi_surface == primary), + ok(gdi_surface == backbuffer || broken(gdi_surface == primary), "Got unexpected surface %p, expected %p.\n", gdi_surface, backbuffer); IDirectDrawSurface7_Release(gdi_surface);
Hi,
While running your changed tests on Windows, 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=46516
Your paranoid android.
=== w8 (32 bit report) ===
ddraw: ddraw1.c:10573: Test failed: Got unexpected color 0x00ffffff.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)