Rebase against 6c7760f2175e241b330cde0a902c96d9007922e0.

This commit is contained in:
Sebastian Lackner 2017-04-21 13:20:03 +02:00
parent bd070a400c
commit 89777bdb23
5 changed files with 25 additions and 168 deletions

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "f7402accc40b66140be4d27c5ad1b2fee8532dfc"
echo "6c7760f2175e241b330cde0a902c96d9007922e0"
}
# Show version information
@ -419,7 +419,6 @@ patch_enable_all ()
enable_wined3d_CSMT_Helper="$1"
enable_wined3d_CSMT_Main="$1"
enable_wined3d_DXTn="$1"
enable_wined3d_Error_Handling="$1"
enable_wined3d_GTX_560M="$1"
enable_wined3d_Limit_Vram="$1"
enable_wined3d_QUERY_Stubs="$1"
@ -1489,9 +1488,6 @@ patch_enable ()
wined3d-DXTn)
enable_wined3d_DXTn="$2"
;;
wined3d-Error_Handling)
enable_wined3d_Error_Handling="$2"
;;
wined3d-GTX_560M)
enable_wined3d_GTX_560M="$2"
;;
@ -8691,20 +8687,6 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Error_Handling
# |
# | Modified files:
# | * dlls/wined3d/cs.c, dlls/wined3d/shader.c
# |
if test "$enable_wined3d_Error_Handling" -eq 1; then
patch_apply wined3d-Error_Handling/0001-wined3d-Release-resources-on-error-in-wined3d_cs_exe.patch
patch_apply wined3d-Error_Handling/0002-wined3d-Fix-doublefree-race-condition-in-geometry_sh.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Release resources on error in wined3d_cs_exec_blt_sub_resource.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Fix doublefree / race condition in geometry_shader_init.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-GTX_560M
# |
# | Modified files:

View File

@ -1,4 +1,4 @@
From 5fa6d005fdb4c9d7e508de6f49263380ee12f059 Mon Sep 17 00:00:00 2001
From 66e6b4de0d88527f5b0efb4d6a1658fbe2fcb84b Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 00:12:31 +0100
Subject: wined3d: Introduce a separate priority queue.
@ -9,7 +9,7 @@ Subject: wined3d: Introduce a separate priority queue.
2 files changed, 67 insertions(+), 59 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 08fb316402..33b2422d98 100644
index 7dc00ef5d9..9a05359fec 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -428,7 +428,7 @@ void wined3d_cs_emit_sync(struct wined3d_cs *cs)
@ -535,13 +535,13 @@ index 08fb316402..33b2422d98 100644
- queue->tail = queue->head = 0;
TRACE("Stopped.\n");
return 0;
FreeLibraryAndExitThread(cs->wined3d_module, 0);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b6b9828254..8f6d720902 100644
index 9bb7a791e6..5aef1a9b06 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3258,7 +3258,7 @@ struct wined3d_cs_queue
@@ -3259,7 +3259,7 @@ struct wined3d_cs_queue
struct wined3d_cs_ops
{
@ -550,7 +550,7 @@ index b6b9828254..8f6d720902 100644
void (*submit)(struct wined3d_cs *cs);
void (*submit_and_wait)(struct wined3d_cs *cs);
void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
@@ -3274,7 +3274,9 @@ struct wined3d_cs
@@ -3276,7 +3276,9 @@ struct wined3d_cs
HANDLE thread;
DWORD thread_id;

View File

@ -9,7 +9,7 @@ Based on patches by:
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -1279,6 +1279,9 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
@@ -1274,6 +1274,9 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
const struct wined3d_box *box, const void *data)
{
UINT offset, size;
@ -19,7 +19,7 @@ diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
HRESULT hr;
BYTE *ptr;
@@ -1293,7 +1296,14 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
@@ -1288,7 +1291,14 @@ HRESULT wined3d_buffer_upload_data(struct wined3d_buffer *buffer,
size = buffer->resource.size;
}
@ -977,9 +977,9 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
queue->tail = queue->head = 0;
+#endif /* STAGING_CSMT */
TRACE("Stopped.\n");
return 0;
FreeLibraryAndExitThread(cs->wined3d_module, 0);
}
@@ -2504,17 +2907,28 @@ fail:
@@ -2514,17 +2917,28 @@ fail:
void wined3d_cs_destroy(struct wined3d_cs *cs)
{
@ -1052,7 +1052,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_device_delete_opengl_contexts(device);
if (device->fb.depth_stencil)
@@ -4059,6 +4072,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4107,6 +4120,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
return WINED3DERR_INVALIDCALL;
}
@ -1060,7 +1060,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
if (dst_texture->sub_resources[dst_sub_resource_idx].map_count)
{
WARN("Destination sub-resource %u is mapped.\n", dst_sub_resource_idx);
@@ -4069,6 +4083,18 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4117,6 +4131,18 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
{
WARN("Source sub-resource %u is mapped.\n", src_sub_resource_idx);
return WINED3DERR_INVALIDCALL;
@ -1079,7 +1079,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
if (!src_box)
@@ -5100,3 +5126,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5148,3 +5174,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}
@ -1556,7 +1556,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -713,6 +713,10 @@ static void wined3d_shader_resource_view_cs_init(void *object)
@@ -716,6 +716,10 @@ static void wined3d_shader_resource_view_cs_init(void *object)
debug_d3dformat(resource->format->id), debug_d3dformat(view_format->id));
}
}
@ -1567,7 +1567,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
}
static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_view *view,
@@ -729,6 +733,9 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
@@ -732,6 +736,9 @@ static HRESULT wined3d_shader_resource_view_init(struct wined3d_shader_resource_
wined3d_resource_incref(view->resource = resource);
@ -1577,7 +1577,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
wined3d_cs_init_object(resource->device->cs, wined3d_shader_resource_view_cs_init, view);
return WINED3D_OK;
@@ -895,6 +902,10 @@ static void wined3d_unordered_access_view_cs_init(void *object)
@@ -898,6 +905,10 @@ static void wined3d_unordered_access_view_cs_init(void *object)
desc, texture, view->format);
}
}
@ -1588,7 +1588,7 @@ diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
}
static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_access_view *view,
@@ -914,6 +925,9 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
@@ -917,6 +928,9 @@ static HRESULT wined3d_unordered_access_view_init(struct wined3d_unordered_acces
wined3d_resource_incref(view->resource = resource);
@ -1616,7 +1616,7 @@ diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2638,6 +2638,16 @@ struct wined3d_state
@@ -2639,6 +2639,16 @@ struct wined3d_state
struct wined3d_rasterizer_state *rasterizer_state;
};
@ -1633,7 +1633,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
#define WINED3D_UNMAPPED_STAGE ~0u
/* Multithreaded flag. Removed from the public header to signal that
@@ -2749,6 +2759,12 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -2750,6 +2760,12 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void device_invalidate_state(const struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN;
@ -1646,7 +1646,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2935,7 +2951,11 @@ struct wined3d_texture
@@ -2936,7 +2952,11 @@ struct wined3d_texture
unsigned int map_count;
DWORD locations;
@ -1658,7 +1658,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
} sub_resources[1];
};
@@ -3246,8 +3266,15 @@ struct wined3d_cs_queue
@@ -3247,8 +3267,15 @@ struct wined3d_cs_queue
struct wined3d_cs_ops
{
@ -1674,7 +1674,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
unsigned int start_idx, unsigned int count, const void *constants);
};
@@ -3261,13 +3288,23 @@ struct wined3d_cs
@@ -3263,13 +3290,23 @@ struct wined3d_cs
HANDLE thread;
DWORD thread_id;
@ -1698,7 +1698,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
};
struct wined3d_cs *wined3d_cs_create(struct wined3d_device *device) DECLSPEC_HIDDEN;
@@ -3289,6 +3326,9 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
@@ -3291,6 +3328,9 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, int base_vertex_idx,
unsigned int start_idx, unsigned int index_count, unsigned int start_instance,
unsigned int instance_count, BOOL indexed) DECLSPEC_HIDDEN;
@ -1708,7 +1708,7 @@ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
void wined3d_cs_emit_flush(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *swapchain,
@@ -3341,6 +3381,9 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
@@ -3343,6 +3383,9 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs,
struct wined3d_vertex_declaration *declaration) DECLSPEC_HIDDEN;
void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_viewport *viewport) DECLSPEC_HIDDEN;

View File

@ -1,77 +0,0 @@
From 8e21a757af350191bf35b309870f9863475c8b80 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 14 Apr 2017 17:32:13 +0200
Subject: wined3d: Release resources on error in
wined3d_cs_exec_blt_sub_resource.
---
dlls/wined3d/cs.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 43352eb7cb..5ea7650d94 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1934,14 +1934,14 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
FIXME("Flags %#x not implemented for %s resources.\n",
op->flags, debug_d3dresourcetype(op->dst_resource->type));
- return;
+ goto error;
}
if (op->src_resource->format != op->dst_resource->format)
{
FIXME("Format conversion not implemented for %s resources.\n",
debug_d3dresourcetype(op->dst_resource->type));
- return;
+ goto error;
}
update_w = op->dst_box.right - op->dst_box.left;
@@ -1953,14 +1953,14 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
FIXME("Stretching not implemented for %s resources.\n",
debug_d3dresourcetype(op->dst_resource->type));
- return;
+ goto error;
}
if (op->src_box.left || op->src_box.top || op->src_box.front)
{
FIXME("Source box %s not supported for %s resources.\n",
debug_box(&op->src_box), debug_d3dresourcetype(op->dst_resource->type));
- return;
+ goto error;
}
dst_texture = texture_from_resource(op->dst_resource);
@@ -1974,7 +1974,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
ERR("Failed to load source sub-resource into %s.\n",
wined3d_debug_location(src_texture->resource.map_binding));
context_release(context);
- return;
+ goto error;
}
level = op->dst_sub_resource_idx % dst_texture->level_count;
@@ -1989,7 +1989,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
{
ERR("Failed to load destination sub-resource.\n");
context_release(context);
- return;
+ goto error;
}
wined3d_texture_get_memory(src_texture, op->src_sub_resource_idx, &addr, src_texture->resource.map_binding);
@@ -2009,6 +2009,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(op->dst_resource->type));
}
+error:
if (op->src_resource)
wined3d_resource_release(op->src_resource);
wined3d_resource_release(op->dst_resource);
--
2.12.2

View File

@ -1,48 +0,0 @@
From 4b68eeba50dfdeed2472c7de8cf868bbcdb9883d Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 14 Apr 2017 17:45:19 +0200
Subject: wined3d: Fix doublefree / race condition in geometry_shader_init.
---
dlls/wined3d/shader.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 3681a8d621..7dc276f575 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -3433,21 +3433,23 @@ static HRESULT geometry_shader_init(struct wined3d_shader *shader, struct wined3
const struct wined3d_shader_desc *desc, const struct wined3d_stream_output_desc *so_desc,
void *parent, const struct wined3d_parent_ops *parent_ops)
{
+ struct wined3d_stream_output_element *elements = NULL;
HRESULT hr;
+ if (so_desc && !(elements = wined3d_calloc(so_desc->element_count, sizeof(*elements))))
+ return E_OUTOFMEMORY;
+
if (FAILED(hr = shader_init(shader, device, desc, 0, WINED3D_SHADER_TYPE_GEOMETRY, parent, parent_ops)))
+ {
+ HeapFree(GetProcessHeap(), 0, elements);
return hr;
+ }
if (so_desc)
{
- struct wined3d_stream_output_desc *d = &shader->u.gs.so_desc;
- *d = *so_desc;
- if (!(d->elements = wined3d_calloc(so_desc->element_count, sizeof(*d->elements))))
- {
- wined3d_cs_destroy_object(shader->device->cs, wined3d_shader_destroy_object, shader);
- return E_OUTOFMEMORY;
- }
- memcpy(d->elements, so_desc->elements, so_desc->element_count * sizeof(*d->elements));
+ shader->u.gs.so_desc = *so_desc;
+ shader->u.gs.so_desc.elements = elements;
+ memcpy(elements, so_desc->elements, so_desc->element_count * sizeof(*elements));
}
return WINED3D_OK;
--
2.12.2