78920: Subject: [PATCH 1/5] ddraw: Store the primary surface.

buildbot at kegel.com buildbot at kegel.com
Thu Sep 15 13:12:31 CDT 2011


This is an experimental automated build and test service.
Please feel free to ignore this email while we work the kinks out.

For more info about this message, see http://wiki.winehq.org/BuildBot

The Buildbot has detected a failed build on builder runtests-default while building Wine.
Full details are available at: http://buildbot.kegel.com/builders/runtests-default/builds/110 (though maybe not for long, as I'm still reinstalling the buildbot periodically while experimenting)
BUILD FAILED: failed shell_3

Errors:
bitmap.c:2771: Test failed: StretchBlt expected { CAFED00D, 00000000, 00000000, 00000000 } got { 76543210, 00000000, 00000000, 00000000 } stretching { 0, 0, 2, 2 } to { 0, 0, 1, 1 } from line 2857
make: *** [bitmap.ok] Error 1

-------------- next part --------------
From: Henri Verbeet <hverbeet at codeweavers.com>
Subject: [PATCH 1/5] ddraw: Store the primary surface.
Message-Id: <1316109713-1269-1-git-send-email-hverbeet at codeweavers.com>
Date: Thu, 15 Sep 2011 20:01:49 +0200

---
 dlls/ddraw/ddraw.c         |   47 ++++++++++---------------------------------
 dlls/ddraw/ddraw_private.h |    2 +
 dlls/ddraw/surface.c       |    3 ++
 3 files changed, 16 insertions(+), 36 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 53230cb..7e6d372 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1974,41 +1974,21 @@ static HRESULT WINAPI ddraw4_TestCooperativeLevel(IDirectDraw4 *iface)
 static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurface7 **GDISurface)
 {
     IDirectDrawImpl *This = impl_from_IDirectDraw7(iface);
-    struct wined3d_surface *wined3d_surface;
-    IDirectDrawSurface7 *ddsurf;
-    HRESULT hr;
-    DDSCAPS2 ddsCaps;
 
     TRACE("iface %p, surface %p.\n", iface, GDISurface);
 
-    /* Get the back buffer from the wineD3DDevice and search its
-     * attached surfaces for the front buffer. */
     EnterCriticalSection(&ddraw_cs);
-    hr = wined3d_device_get_back_buffer(This->wined3d_device,
-            0, 0, WINED3DBACKBUFFER_TYPE_MONO, &wined3d_surface);
-    if (FAILED(hr) || !wined3d_surface)
+
+    if (!(*GDISurface = &This->primary->IDirectDrawSurface7_iface))
     {
-        ERR("IWineD3DDevice::GetBackBuffer failed\n");
+        WARN("Primary not created yet.\n");
         LeaveCriticalSection(&ddraw_cs);
         return DDERR_NOTFOUND;
     }
+    IDirectDrawSurface7_AddRef(*GDISurface);
 
-    ddsurf = wined3d_surface_get_parent(wined3d_surface);
-    wined3d_surface_decref(wined3d_surface);
-
-    /* Find the front buffer */
-    ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER;
-    hr = IDirectDrawSurface7_GetAttachedSurface(ddsurf,
-                                                &ddsCaps,
-                                                GDISurface);
-    if(hr != DD_OK)
-    {
-        ERR("IDirectDrawSurface7::GetAttachedSurface failed, hr = %x\n", hr);
-    }
-
-    /* The AddRef is OK this time */
     LeaveCriticalSection(&ddraw_cs);
-    return hr;
+    return DD_OK;
 }
 
 static HRESULT WINAPI ddraw4_GetGDISurface(IDirectDraw4 *iface, IDirectDrawSurface4 **surface)
@@ -2803,19 +2783,11 @@ static HRESULT ddraw_create_swapchain(IDirectDrawImpl *ddraw, IDirectDrawSurface
     WINED3DPRESENT_PARAMETERS presentation_parameters;
     IDirectDrawSurfaceImpl *target = surface;
     HRESULT hr = WINED3D_OK;
-    struct list *entry;
 
-    /* Search for the primary to use as render target. */
-    LIST_FOR_EACH(entry, &ddraw->surface_list)
+    if (ddraw->primary)
     {
-        IDirectDrawSurfaceImpl *primary = LIST_ENTRY(entry, IDirectDrawSurfaceImpl, surface_list_entry);
-        if ((primary->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER))
-                == (DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER))
-        {
-            TRACE("Using primary %p as render target.\n", target);
-            target = primary;
-            break;
-        }
+        TRACE("Using primary %p.\n", ddraw->primary);
+        target = ddraw->primary;
     }
 
     memset(&presentation_parameters, 0, sizeof(presentation_parameters));
@@ -3251,6 +3223,9 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
         }
     }
 
+    if (desc2.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
+        ddraw->primary = object;
+
     /* Create a WineD3DTexture if a texture was requested */
     if (desc2.ddsCaps.dwCaps & DDSCAPS_TEXTURE)
     {
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index 9721915..b5d85d1 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -88,6 +88,8 @@ struct IDirectDrawImpl
     struct wined3d_device *wined3d_device;
     BOOL                    d3d_initialized;
 
+    IDirectDrawSurfaceImpl *primary;
+
     /* DirectDraw things, which are not handled by WineD3D */
     DWORD                   cooperative_level;
 
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 1b6d6ff..7357742 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -5100,6 +5100,9 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren
     /* Reduce the ddraw surface count. */
     list_remove(&surface->surface_list_entry);
 
+    if (surface == surface->ddraw->primary)
+        surface->ddraw->primary = NULL;
+
     HeapFree(GetProcessHeap(), 0, surface);
 }
 
-- 
1.7.3.4



More information about the wine-tests-results mailing list