Rebase against b8a8e1bde9382897927945ec0b58b8a2fcfcfe59.

This commit is contained in:
Sebastian Lackner 2017-05-24 23:55:00 +02:00
parent 2ca6aebfaa
commit 8b1d3d07ab
8 changed files with 173 additions and 1638 deletions

View File

@ -1,4 +1,4 @@
From 988abb92ab5dc363b9ea734e256959eb542391e2 Mon Sep 17 00:00:00 2001
From 0c9c23711c9608551eebd1d60159e2fe523347f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 12 Apr 2016 01:02:34 +0200
Subject: uiautomationcore: Add dll and stub some functions.
@ -11,7 +11,7 @@ Subject: uiautomationcore: Add dll and stub some functions.
4 files changed, 61 insertions(+), 12 deletions(-)
diff --git a/dlls/uiautomationcore/Makefile.in b/dlls/uiautomationcore/Makefile.in
index 78d6254a01..029fc2e499 100644
index 78d6254a015..029fc2e4995 100644
--- a/dlls/uiautomationcore/Makefile.in
+++ b/dlls/uiautomationcore/Makefile.in
@@ -1,4 +1,5 @@
@ -21,7 +21,7 @@ index 78d6254a01..029fc2e499 100644
C_SRCS = \
uia_main.c
diff --git a/dlls/uiautomationcore/uia_main.c b/dlls/uiautomationcore/uia_main.c
index 6e795ab88f..37c56dacd5 100644
index 31b7d3e7aa1..ff0506dc7d9 100644
--- a/dlls/uiautomationcore/uia_main.c
+++ b/dlls/uiautomationcore/uia_main.c
@@ -1,4 +1,5 @@
@ -124,7 +124,7 @@ index 6e795ab88f..37c56dacd5 100644
return 1;
}
@@ -81,6 +122,6 @@ int WINAPI UiaLookupId(enum AutomationIdentifierType type, const GUID *guid)
@@ -81,7 +122,7 @@ int WINAPI UiaLookupId(enum AutomationIdentifierType type, const GUID *guid)
LRESULT WINAPI UiaReturnRawElementProvider(HWND hwnd, WPARAM wParam,
LPARAM lParam, IRawElementProviderSimple *elprov)
{
@ -132,8 +132,9 @@ index 6e795ab88f..37c56dacd5 100644
+ FIXME("(%p, %lx, %lx, %p): stub!\n", hwnd, wParam, lParam, elprov);
return 0;
}
diff --git a/dlls/uiautomationcore/uiautomationcore.spec b/dlls/uiautomationcore/uiautomationcore.spec
index bff1303eda..221711c41d 100644
index 48a06b2fdad..8e676adaae1 100644
--- a/dlls/uiautomationcore/uiautomationcore.spec
+++ b/dlls/uiautomationcore/uiautomationcore.spec
@@ -53,6 +53,8 @@
@ -160,7 +161,7 @@ index bff1303eda..221711c41d 100644
+@ stub UiaProviderForNonClient
+@ stub UiaProviderFromIAccessible
@ stub UiaRaiseAsyncContentLoadedEvent
@ stub UiaRaiseAutomationEvent
@ stdcall UiaRaiseAutomationEvent(ptr long)
@ stub UiaRaiseAutomationPropertyChangedEvent
@ stub UiaRaiseStructureChangedEvent
+@ stub UiaRaiseTextEditTextChangedEvent
@ -168,7 +169,7 @@ index bff1303eda..221711c41d 100644
@ stub UiaRemoveEvent
@ stdcall UiaReturnRawElementProvider(long long long ptr)
diff --git a/include/uiautomationcoreapi.h b/include/uiautomationcoreapi.h
index 6c1752ec64..1a844d0cb7 100644
index 12c509fbec8..5ddf4b67e3d 100644
--- a/include/uiautomationcoreapi.h
+++ b/include/uiautomationcoreapi.h
@@ -39,18 +39,19 @@ DECLARE_HANDLE(HUIAPATTERNOBJECT);
@ -193,8 +194,8 @@ index 6c1752ec64..1a844d0cb7 100644
-int WINAPI UiaLookupId(enum AutomationIdentifierType type, const GUID *guid);
+int WINAPI UiaLookupId(AutomationIdentifierType type, const GUID *guid);
BOOL WINAPI UiaPatternRelease(HUIAPATTERNOBJECT hobj);
HRESULT WINAPI UiaRaiseAutomationEvent(IRawElementProviderSimple *provider, EVENTID id);
LRESULT WINAPI UiaReturnRawElementProvider(HWND hwnd, WPARAM wParam, LPARAM lParam, IRawElementProviderSimple *elprov);
BOOL WINAPI UiaTextRangeRelease(HUIATEXTRANGE hobj);
--
2.11.0
2.12.2

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "3f01ab4c39ffa50e26916a5f33d82dec1a2e42dc"
echo "b8a8e1bde9382897927945ec0b58b8a2fcfcfe59"
}
# Show version information
@ -8868,9 +8868,8 @@ fi
# | * [#11674] Support for CSMT (command stream) to increase graphic performance
# |
# | Modified files:
# | * dlls/wined3d/buffer.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/resource.c, dlls/wined3d/surface.c,
# | dlls/wined3d/swapchain.c, dlls/wined3d/texture.c, dlls/wined3d/view.c, dlls/wined3d/wined3d_main.c,
# | dlls/wined3d/wined3d_private.h
# | * dlls/wined3d/buffer.c, dlls/wined3d/cs.c, dlls/wined3d/device.c, dlls/wined3d/surface.c, dlls/wined3d/swapchain.c,
# | dlls/wined3d/texture.c, dlls/wined3d/view.c, dlls/wined3d/wined3d_main.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_CSMT_Main" -eq 1; then
patch_apply wined3d-CSMT_Main/9999-IfDefined.patch
@ -8878,8 +8877,6 @@ if test "$enable_wined3d_CSMT_Main" -eq 1; then
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Add additional synchronization CS ops.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Send blits through the command stream.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Wrap GL BOs in a structure.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Introduce a separate priority queue.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for maps/unmaps.", 1 },';
printf '%s\n' '+ { "Stefan Dösinger", "wined3d: Don'\''t call glFinish before swapping.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Use priority queue for update_sub_resource.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Reset context before destruction.", 1 },';

View File

@ -1,4 +1,4 @@
From ee2d4cc10c524a813e4eefcf3935c63479bb84be Mon Sep 17 00:00:00 2001
From 443951f5ef3359b18334b50d72724f99ce77f72e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Mon, 29 Apr 2013 18:49:53 +0200
Subject: wined3d: Send blits through the command stream.
@ -11,10 +11,10 @@ between surface_blt and surface_blt_ugly isn't particularly nice.
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index cbb0406dccf..613df2077a5 100644
index cf446c7cd17..b3fea23c821 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4199,16 +4199,17 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4241,16 +4241,17 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
return WINED3DERR_INVALIDCALL;
}
@ -31,7 +31,7 @@ index cbb0406dccf..613df2077a5 100644
- WARN("Source sub-resource %u is mapped.\n", src_sub_resource_idx);
- return WINED3DERR_INVALIDCALL;
+ struct wined3d_device *device = dst_texture->resource.device;
+ device->cs->ops->finish(device->cs);
+ device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
+ if (dst_texture->sub_resources[dst_sub_resource_idx].map_count ||
+ src_texture->sub_resources[src_sub_resource_idx].map_count)
+ {
@ -42,7 +42,7 @@ index cbb0406dccf..613df2077a5 100644
if (!src_box)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index ebc317bd43d..d43ee068a30 100644
index a77c9835bbb..55cc49be5e0 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3231,8 +3231,14 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
@ -52,7 +52,7 @@ index ebc317bd43d..d43ee068a30 100644
- WARN("Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.\n");
- return WINEDDERR_SURFACEBUSY;
+ struct wined3d_device *device = dst_texture->resource.device;
+ device->cs->ops->finish(device->cs);
+ device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
+ if (dst_texture->sub_resources[dst_sub_resource_idx].map_count
+ || (src_texture && src_texture->sub_resources[src_sub_resource_idx].map_count))
+ {

View File

@ -1,672 +0,0 @@
From 8903436b5d2dfc6a358191002a3d5eacd6a784f6 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.
---
dlls/wined3d/cs.c | 135 ++++++++++++++++++++++++-----------------
dlls/wined3d/device.c | 6 +-
dlls/wined3d/swapchain.c | 4 +-
dlls/wined3d/texture.c | 2 +-
dlls/wined3d/wined3d_private.h | 7 ++-
5 files changed, 89 insertions(+), 65 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 9d6cf3676b6..10664a5cc50 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -427,6 +427,17 @@ static void wined3d_cs_exec_nop(struct wined3d_cs *cs, const void *data)
{
}
+void wined3d_cs_emit_sync(struct wined3d_cs *cs)
+{
+ struct wined3d_cs_nop *op;
+
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
+ op->opcode = WINED3D_CS_OP_NOP;
+
+ cs->ops->submit(cs);
+ cs->ops->finish(cs);
+}
+
static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data)
{
const struct wined3d_cs_present *op = data;
@@ -454,7 +465,7 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
unsigned int i;
LONG pending;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_PRESENT;
op->dst_window_override = dst_window_override;
op->swapchain = swapchain;
@@ -515,7 +526,7 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
struct wined3d_cs_clear *op;
unsigned int i;
- op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]));
+ op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]), 0);
op->opcode = WINED3D_CS_OP_CLEAR;
op->flags = flags;
op->rt_count = rt_count;
@@ -551,7 +562,7 @@ void wined3d_cs_emit_clear_rendertarget_view(struct wined3d_cs *cs, struct wined
struct wined3d_fb_state fb;
} *extra;
- op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[1]) + sizeof(*extra));
+ op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[1]) + sizeof(*extra), 0);
extra = (void *)&op->rects[1];
extra->fb.render_targets = &extra->rt;
op->fb = &extra->fb;
@@ -707,7 +718,7 @@ void wined3d_cs_emit_dispatch(struct wined3d_cs *cs,
const struct wined3d_state *state = &cs->device->state;
struct wined3d_cs_dispatch *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_DISPATCH;
op->group_count_x = group_count_x;
op->group_count_y = group_count_y;
@@ -781,7 +792,7 @@ void wined3d_cs_emit_draw(struct wined3d_cs *cs, GLenum primitive_type, unsigned
struct wined3d_cs_draw *op;
unsigned int i;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_DRAW;
op->primitive_type = primitive_type;
op->patch_vertex_count = patch_vertex_count;
@@ -836,7 +847,7 @@ void wined3d_cs_emit_flush(struct wined3d_cs *cs)
{
struct wined3d_cs_flush *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_FLUSH;
cs->ops->submit(cs);
@@ -854,7 +865,7 @@ void wined3d_cs_emit_set_predication(struct wined3d_cs *cs, struct wined3d_query
{
struct wined3d_cs_set_predication *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_PREDICATION;
op->predicate = predicate;
op->value = value;
@@ -874,7 +885,7 @@ void wined3d_cs_emit_set_viewport(struct wined3d_cs *cs, const struct wined3d_vi
{
struct wined3d_cs_set_viewport *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_VIEWPORT;
op->viewport = *viewport;
@@ -893,7 +904,7 @@ void wined3d_cs_emit_set_scissor_rect(struct wined3d_cs *cs, const RECT *rect)
{
struct wined3d_cs_set_scissor_rect *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_SCISSOR_RECT;
op->rect = *rect;
@@ -913,7 +924,7 @@ void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int v
{
struct wined3d_cs_set_rendertarget_view *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_RENDERTARGET_VIEW;
op->view_idx = view_idx;
op->view = view;
@@ -962,7 +973,7 @@ void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3
{
struct wined3d_cs_set_depth_stencil_view *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW;
op->view = view;
@@ -981,7 +992,7 @@ void wined3d_cs_emit_set_vertex_declaration(struct wined3d_cs *cs, struct wined3
{
struct wined3d_cs_set_vertex_declaration *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_VERTEX_DECLARATION;
op->declaration = declaration;
@@ -1013,7 +1024,7 @@ void wined3d_cs_emit_set_stream_source(struct wined3d_cs *cs, UINT stream_idx,
{
struct wined3d_cs_set_stream_source *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE;
op->stream_idx = stream_idx;
op->buffer = buffer;
@@ -1039,7 +1050,7 @@ void wined3d_cs_emit_set_stream_source_freq(struct wined3d_cs *cs, UINT stream_i
{
struct wined3d_cs_set_stream_source_freq *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ;
op->stream_idx = stream_idx;
op->frequency = frequency;
@@ -1072,7 +1083,7 @@ void wined3d_cs_emit_set_stream_output(struct wined3d_cs *cs, UINT stream_idx,
{
struct wined3d_cs_set_stream_output *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_STREAM_OUTPUT;
op->stream_idx = stream_idx;
op->buffer = buffer;
@@ -1104,7 +1115,7 @@ void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buff
{
struct wined3d_cs_set_index_buffer *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_INDEX_BUFFER;
op->buffer = buffer;
op->format_id = format_id;
@@ -1134,7 +1145,7 @@ void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_sha
{
struct wined3d_cs_set_constant_buffer *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_CONSTANT_BUFFER;
op->type = type;
op->cb_idx = cb_idx;
@@ -1226,7 +1237,7 @@ void wined3d_cs_emit_set_texture(struct wined3d_cs *cs, UINT stage, struct wined
{
struct wined3d_cs_set_texture *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_TEXTURE;
op->stage = stage;
op->texture = texture;
@@ -1258,7 +1269,7 @@ void wined3d_cs_emit_set_shader_resource_view(struct wined3d_cs *cs, enum wined3
{
struct wined3d_cs_set_shader_resource_view *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_SHADER_RESOURCE_VIEW;
op->type = type;
op->view_idx = view_idx;
@@ -1288,7 +1299,7 @@ void wined3d_cs_emit_set_unordered_access_view(struct wined3d_cs *cs, enum wined
{
struct wined3d_cs_set_unordered_access_view *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_UNORDERED_ACCESS_VIEW;
op->pipeline = pipeline;
op->view_idx = view_idx;
@@ -1313,7 +1324,7 @@ void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type
{
struct wined3d_cs_set_sampler *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_SAMPLER;
op->type = type;
op->sampler_idx = sampler_idx;
@@ -1338,7 +1349,7 @@ void wined3d_cs_emit_set_shader(struct wined3d_cs *cs, enum wined3d_shader_type
{
struct wined3d_cs_set_shader *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_SHADER;
op->type = type;
op->shader = shader;
@@ -1359,7 +1370,7 @@ void wined3d_cs_emit_set_rasterizer_state(struct wined3d_cs *cs,
{
struct wined3d_cs_set_rasterizer_state *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_RASTERIZER_STATE;
op->state = rasterizer_state;
@@ -1378,7 +1389,7 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render
{
struct wined3d_cs_set_render_state *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_RENDER_STATE;
op->state = state;
op->value = value;
@@ -1399,7 +1410,7 @@ void wined3d_cs_emit_set_texture_state(struct wined3d_cs *cs, UINT stage,
{
struct wined3d_cs_set_texture_state *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_TEXTURE_STATE;
op->stage = stage;
op->state = state;
@@ -1421,7 +1432,7 @@ void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx,
{
struct wined3d_cs_set_sampler_state *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_SAMPLER_STATE;
op->sampler_idx = sampler_idx;
op->state = state;
@@ -1444,7 +1455,7 @@ void wined3d_cs_emit_set_transform(struct wined3d_cs *cs, enum wined3d_transform
{
struct wined3d_cs_set_transform *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_TRANSFORM;
op->state = state;
op->matrix = *matrix;
@@ -1464,7 +1475,7 @@ void wined3d_cs_emit_set_clip_plane(struct wined3d_cs *cs, UINT plane_idx, const
{
struct wined3d_cs_set_clip_plane *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_CLIP_PLANE;
op->plane_idx = plane_idx;
op->plane = *plane;
@@ -1540,7 +1551,7 @@ void wined3d_cs_emit_set_color_key(struct wined3d_cs *cs, struct wined3d_texture
{
struct wined3d_cs_set_color_key *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_COLOR_KEY;
op->texture = texture;
op->flags = flags;
@@ -1567,7 +1578,7 @@ void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_ma
{
struct wined3d_cs_set_material *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_MATERIAL;
op->material = *material;
@@ -1615,7 +1626,7 @@ void wined3d_cs_emit_set_light(struct wined3d_cs *cs, const struct wined3d_light
{
struct wined3d_cs_set_light *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_LIGHT;
op->light = *light;
@@ -1648,7 +1659,7 @@ void wined3d_cs_emit_set_light_enable(struct wined3d_cs *cs, unsigned int idx, B
{
struct wined3d_cs_set_light_enable *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_SET_LIGHT_ENABLE;
op->idx = idx;
op->enable = enable;
@@ -1713,7 +1724,7 @@ static void wined3d_cs_mt_push_constants(struct wined3d_cs *cs, enum wined3d_pus
size_t size;
size = count * wined3d_cs_push_constant_info[p].size;
- op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_push_constants, constants[size]));
+ op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_push_constants, constants[size]), 0);
op->opcode = WINED3D_CS_OP_PUSH_CONSTANTS;
op->type = p;
op->start_idx = start_idx;
@@ -1737,7 +1748,7 @@ void wined3d_cs_emit_reset_state(struct wined3d_cs *cs)
{
struct wined3d_cs_reset_state *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_RESET_STATE;
cs->ops->submit(cs);
@@ -1754,7 +1765,7 @@ static void wined3d_cs_emit_callback(struct wined3d_cs *cs, void (*callback)(voi
{
struct wined3d_cs_callback *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_CALLBACK;
op->callback = callback;
op->object = object;
@@ -1815,7 +1826,7 @@ void wined3d_cs_emit_query_issue(struct wined3d_cs *cs, struct wined3d_query *qu
{
struct wined3d_cs_query_issue *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_QUERY_ISSUE;
op->query = query;
op->flags = flags;
@@ -1836,7 +1847,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso
{
struct wined3d_cs_preload_resource *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_PRELOAD_RESOURCE;
op->resource = resource;
@@ -1858,7 +1869,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou
{
struct wined3d_cs_unload_resource *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE;
op->resource = resource;
@@ -1886,7 +1897,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
* increasing the map count would be visible to applications. */
wined3d_not_from_cs(cs);
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_MAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -1916,7 +1927,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
wined3d_not_from_cs(cs);
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_UNMAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -2056,7 +2067,7 @@ void wined3d_cs_emit_blt_sub_resource(struct wined3d_cs *cs, struct wined3d_reso
{
struct wined3d_cs_blt_sub_resource *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_BLT_SUB_RESOURCE;
op->dst_resource = dst_resource;
op->dst_sub_resource_idx = dst_sub_resource_idx;
@@ -2136,7 +2147,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
{
struct wined3d_cs_update_sub_resource *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -2179,7 +2190,7 @@ void wined3d_cs_emit_add_dirty_texture_region(struct wined3d_cs *cs,
{
struct wined3d_cs_add_dirty_texture_region *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION;
op->texture = texture;
op->layer = layer;
@@ -2207,7 +2218,7 @@ void wined3d_cs_emit_clear_unordered_access_view_uint(struct wined3d_cs *cs,
{
struct wined3d_cs_clear_unordered_access_view *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW;
op->view = view;
op->clear_value = *clear_value;
@@ -2221,11 +2232,10 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs)
{
struct wined3d_cs_stop *op;
- op = cs->ops->require_space(cs, sizeof(*op));
+ op = cs->ops->require_space(cs, sizeof(*op), 0);
op->opcode = WINED3D_CS_OP_STOP;
cs->ops->submit(cs);
- cs->ops->finish(cs);
}
static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
@@ -2276,7 +2286,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view,
};
-static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size)
+static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, int priority)
{
if (size > (cs->data_size - cs->end))
{
@@ -2342,7 +2352,7 @@ static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs_queue *queue)
static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
{
- struct wined3d_cs_queue *queue = &cs->queue;
+ struct wined3d_cs_queue *queue = cs->queue;
struct wined3d_cs_packet *packet;
size_t packet_size;
@@ -2357,15 +2367,15 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
SetEvent(cs->event);
}
-static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
+static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int priority)
{
- struct wined3d_cs_queue *queue = &cs->queue;
+ struct wined3d_cs_queue *queue = priority ? &cs->prio_queue : &cs->norm_queue;
size_t queue_size = ARRAY_SIZE(queue->data);
size_t header_size, packet_size, remaining;
struct wined3d_cs_packet *packet;
if (cs->thread_id == GetCurrentThreadId())
- return wined3d_cs_st_require_space(cs, size);
+ return wined3d_cs_st_require_space(cs, size, priority);
header_size = FIELD_OFFSET(struct wined3d_cs_packet, data[0]);
size = (size + header_size - 1) & ~(header_size - 1);
@@ -2386,7 +2396,7 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
TRACE("Inserting a nop for %lu + %lu bytes.\n",
(unsigned long)header_size, (unsigned long)nop_size);
- nop = wined3d_cs_mt_require_space(cs, nop_size);
+ nop = wined3d_cs_mt_require_space(cs, nop_size, priority);
if (nop_size)
nop->opcode = WINED3D_CS_OP_NOP;
@@ -2417,6 +2427,7 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
head, tail, (unsigned long)packet_size);
}
+ cs->queue = queue;
packet = (struct wined3d_cs_packet *)&queue->data[queue->head];
packet->size = size;
return packet->data;
@@ -2424,11 +2435,15 @@ static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size)
static void wined3d_cs_mt_finish(struct wined3d_cs *cs)
{
+ struct wined3d_cs_queue *queue = cs->queue;
+
if (cs->thread_id == GetCurrentThreadId())
return wined3d_cs_st_finish(cs);
- while (!wined3d_cs_queue_is_empty(&cs->queue))
+ while (!wined3d_cs_queue_is_empty(queue))
wined3d_pause();
+
+ cs->queue = NULL;
}
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
@@ -2454,6 +2469,13 @@ static void poll_queries(struct wined3d_cs *cs)
}
}
+static struct wined3d_cs_queue *wined3d_cs_get_queue(struct wined3d_cs *cs)
+{
+ if (!wined3d_cs_queue_is_empty(&cs->prio_queue)) return &cs->prio_queue;
+ if (!wined3d_cs_queue_is_empty(&cs->norm_queue)) return &cs->norm_queue;
+ return NULL;
+}
+
static void wined3d_cs_wait_event(struct wined3d_cs *cs)
{
InterlockedExchange(&cs->waiting_for_event, TRUE);
@@ -2465,7 +2487,7 @@ static void wined3d_cs_wait_event(struct wined3d_cs *cs)
* Likewise, we can race with the main thread when resetting
* "waiting_for_event", in which case we would need to call
* WaitForSingleObject() because the main thread called SetEvent(). */
- if (!wined3d_cs_queue_is_empty(&cs->queue)
+ if (wined3d_cs_get_queue(cs)
&& InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE))
return;
@@ -2484,7 +2506,6 @@ static DWORD WINAPI wined3d_cs_run(void *ctx)
TRACE("Started.\n");
- queue = &cs->queue;
list_init(&cs->query_poll_list);
cs->thread_id = GetCurrentThreadId();
for (;;)
@@ -2495,7 +2516,7 @@ static DWORD WINAPI wined3d_cs_run(void *ctx)
poll = 0;
}
- if (wined3d_cs_queue_is_empty(queue))
+ if (!(queue = wined3d_cs_get_queue(cs)))
{
if (++spin_count >= WINED3D_CS_SPIN_COUNT && list_empty(&cs->query_poll_list))
wined3d_cs_wait_event(cs);
@@ -2524,7 +2545,6 @@ static DWORD WINAPI wined3d_cs_run(void *ctx)
InterlockedExchange(&queue->tail, tail);
}
- queue->tail = queue->head = 0;
TRACE("Stopped.\n");
FreeLibraryAndExitThread(cs->wined3d_module, 0);
}
@@ -2598,6 +2618,7 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
if (cs->thread)
{
wined3d_cs_emit_stop(cs);
+ WaitForSingleObject(cs->thread, INFINITE);
CloseHandle(cs->thread);
if (!CloseHandle(cs->event))
ERR("Closing event failed.\n");
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index eaa6c6b58ea..aee47263144 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1213,7 +1213,7 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
if (!device->d3d_initialized)
return WINED3DERR_INVALIDCALL;
- device->cs->ops->finish(device->cs);
+ wined3d_cs_emit_sync(device->cs);
if (device->logo_texture)
wined3d_texture_decref(device->logo_texture);
@@ -4245,7 +4245,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
src_texture->sub_resources[src_sub_resource_idx].map_count)
{
struct wined3d_device *device = dst_texture->resource.device;
- device->cs->ops->finish(device->cs);
+ wined3d_cs_emit_sync(device->cs);
if (dst_texture->sub_resources[dst_sub_resource_idx].map_count ||
src_texture->sub_resources[src_sub_resource_idx].map_count)
{
@@ -4741,7 +4741,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n",
device, swapchain_desc, mode, callback, reset_state);
- device->cs->ops->finish(device->cs);
+ wined3d_cs_emit_sync(device->cs);
if (!(swapchain = wined3d_device_get_swapchain(device, 0)))
{
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 4bb8cb15b80..371294aac24 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -116,7 +116,7 @@ ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
{
struct wined3d_device *device = swapchain->device;
- device->cs->ops->finish(device->cs);
+ wined3d_cs_emit_sync(device->cs);
swapchain_cleanup(swapchain);
swapchain->parent_ops->wined3d_object_destroyed(swapchain->parent);
@@ -1208,7 +1208,7 @@ HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapcha
if (buffer_count && buffer_count != swapchain->desc.backbuffer_count)
FIXME("Cannot change the back buffer count yet.\n");
- device->cs->ops->finish(device->cs);
+ wined3d_cs_emit_sync(device->cs);
if (!width || !height)
{
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 01a29e605ac..3bd438f64d6 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3225,7 +3225,7 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
|| src_texture->sub_resources[src_sub_resource_idx].map_count)
{
struct wined3d_device *device = dst_texture->resource.device;
- device->cs->ops->finish(device->cs);
+ wined3d_cs_emit_sync(device->cs);
if (dst_texture->sub_resources[dst_sub_resource_idx].map_count
|| (src_texture && src_texture->sub_resources[src_sub_resource_idx].map_count))
{
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e1d18ee9b83..550c0d367a7 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3285,7 +3285,7 @@ struct wined3d_cs_queue
struct wined3d_cs_ops
{
- void *(*require_space)(struct wined3d_cs *cs, size_t size);
+ void *(*require_space)(struct wined3d_cs *cs, size_t size, int priority);
void (*submit)(struct wined3d_cs *cs);
void (*finish)(struct wined3d_cs *cs);
void (*push_constants)(struct wined3d_cs *cs, enum wined3d_push_constants p,
@@ -3302,7 +3302,9 @@ struct wined3d_cs
HANDLE thread;
DWORD thread_id;
- struct wined3d_cs_queue queue;
+ struct wined3d_cs_queue *queue;
+ struct wined3d_cs_queue norm_queue;
+ struct wined3d_cs_queue prio_queue;
size_t data_size, start, end;
void *data;
struct list query_poll_list;
@@ -3385,6 +3387,7 @@ 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;
+void wined3d_cs_emit_sync(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_resource *resource,
unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch,
--
2.12.2

View File

@ -1,59 +0,0 @@
From 1ad08ef9f2b5f2830990b179bb38041212b3459e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 8 Feb 2017 00:21:56 +0100
Subject: wined3d: Use priority queue for maps/unmaps.
---
dlls/wined3d/cs.c | 4 ++--
dlls/wined3d/resource.c | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index c74fd1749ca..cb49f38acd3 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1874,7 +1874,7 @@ HRESULT wined3d_cs_map(struct wined3d_cs *cs, struct wined3d_resource *resource,
* increasing the map count would be visible to applications. */
wined3d_not_from_cs(cs);
- op = cs->ops->require_space(cs, sizeof(*op), 0);
+ op = cs->ops->require_space(cs, sizeof(*op), 1);
op->opcode = WINED3D_CS_OP_MAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -1904,7 +1904,7 @@ HRESULT wined3d_cs_unmap(struct wined3d_cs *cs, struct wined3d_resource *resourc
wined3d_not_from_cs(cs);
- op = cs->ops->require_space(cs, sizeof(*op), 0);
+ op = cs->ops->require_space(cs, sizeof(*op), 1);
op->opcode = WINED3D_CS_OP_UNMAP;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index e343067f943..fffa6fbf25c 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -363,6 +363,9 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
flags = wined3d_resource_sanitise_map_flags(resource, flags);
+ if (wined3d_settings.cs_multithreaded)
+ wined3d_resource_wait_idle(resource);
+
return wined3d_cs_map(resource->device->cs, resource, sub_resource_idx, map_desc, box, flags);
}
@@ -378,6 +381,9 @@ HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned
{
TRACE("resource %p, sub_resource_idx %u.\n", resource, sub_resource_idx);
+ if (wined3d_settings.cs_multithreaded)
+ wined3d_resource_wait_idle(resource);
+
return wined3d_cs_unmap(resource->device->cs, resource, sub_resource_idx);
}
--
2.12.2

View File

@ -1,31 +1,44 @@
From 9316955f860efa52c6b58edb4998c120bd43c377 Mon Sep 17 00:00:00 2001
From 606dbb843b9fc141ba8c904798d542696d82af32 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 12 Feb 2017 00:08:28 +0100
Subject: wined3d: Use priority queue for update_sub_resource.
---
dlls/wined3d/cs.c | 2 +-
dlls/wined3d/cs.c | 6 +++---
dlls/wined3d/device.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index f146cbe4633..8dea530b413 100644
index 6bd6f3ed056..b20008d55e7 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -2143,7 +2143,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2139,7 +2139,7 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
{
struct wined3d_cs_update_sub_resource *op;
- op = cs->ops->require_space(cs, sizeof(*op), 0);
+ op = cs->ops->require_space(cs, sizeof(*op), 1);
- op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT);
+ op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP);
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
op->resource = resource;
op->sub_resource_idx = sub_resource_idx;
@@ -2150,10 +2150,10 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
wined3d_resource_acquire(resource);
- cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
+ cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
/* The data pointer may go away, so we need to wait until it is read.
* Copying the data may be faster if it's small. */
- cs->ops->finish(cs, WINED3D_CS_QUEUE_DEFAULT);
+ cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
}
static void wined3d_cs_exec_add_dirty_texture_region(struct wined3d_cs *cs, const void *data)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 07d5970e4b3..56d52952a10 100644
index d3b9a1b55b1..24bc2ba54b2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4286,6 +4286,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4297,6 +4297,8 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n",
device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch);

View File

@ -1,19 +1,19 @@
From 6c606d8f44420417fc8cbb248f57556a26125d0b Mon Sep 17 00:00:00 2001
From cd32330bc6d35331524eb1deef302fa8f5f6d4de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 20 Feb 2017 00:27:25 +0100
Subject: wined3d: Improve wined3d_cs_emit_update_sub_resource.
---
dlls/wined3d/cs.c | 68 ++++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/cs.c | 74 ++++++++++++++++++++++++++++++++++++++++--
dlls/wined3d/device.c | 2 --
dlls/wined3d/wined3d_private.h | 1 +
3 files changed, 69 insertions(+), 2 deletions(-)
3 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 8dea530b413..fc67672fff2 100644
index b20008d55e7..aa83a546e87 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -401,6 +401,7 @@ struct wined3d_cs_update_sub_resource
@@ -402,6 +402,7 @@ struct wined3d_cs_update_sub_resource
unsigned int sub_resource_idx;
struct wined3d_box box;
struct wined3d_sub_resource_data data;
@ -21,7 +21,7 @@ index 8dea530b413..fc67672fff2 100644
};
struct wined3d_cs_add_dirty_texture_region
@@ -2142,6 +2143,49 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
@@ -2138,6 +2139,49 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
unsigned int slice_pitch)
{
struct wined3d_cs_update_sub_resource *op;
@ -48,10 +48,10 @@ index 8dea530b413..fc67672fff2 100644
+ }
+
+ size = FIELD_OFFSET(struct wined3d_cs_update_sub_resource, copy_data[data_size]);
+ if (!cs->ops->check_space(cs, size, 0))
+ if (!cs->ops->check_space(cs, size, WINED3D_CS_QUEUE_DEFAULT))
+ goto no_async;
+
+ op = cs->ops->require_space(cs, size, 0);
+ op = cs->ops->require_space(cs, size, WINED3D_CS_QUEUE_DEFAULT);
+ op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
+ op->resource = resource;
+ op->sub_resource_idx = sub_resource_idx;
@ -63,27 +63,36 @@ index 8dea530b413..fc67672fff2 100644
+
+ wined3d_resource_acquire(resource);
+
+ cs->ops->submit(cs);
+ cs->ops->submit(cs, WINED3D_CS_QUEUE_DEFAULT);
+ return;
+
+no_async:
+ wined3d_resource_wait_idle(resource);
op = cs->ops->require_space(cs, sizeof(*op), 1);
op = cs->ops->require_space(cs, sizeof(*op), WINED3D_CS_QUEUE_MAP);
op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE;
@@ -2282,6 +2326,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2151,8 +2195,6 @@ void wined3d_cs_emit_update_sub_resource(struct wined3d_cs *cs, struct wined3d_r
wined3d_resource_acquire(resource);
cs->ops->submit(cs, WINED3D_CS_QUEUE_MAP);
- /* The data pointer may go away, so we need to wait until it is read.
- * Copying the data may be faster if it's small. */
cs->ops->finish(cs, WINED3D_CS_QUEUE_MAP);
}
@@ -2279,6 +2321,11 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_CLEAR_UNORDERED_ACCESS_VIEW */ wined3d_cs_exec_clear_unordered_access_view,
};
+static BOOL wined3d_cs_st_check_space(struct wined3d_cs *cs, size_t size, int priority)
+static BOOL wined3d_cs_st_check_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
+{
+ return TRUE;
+}
+
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, int priority)
static void *wined3d_cs_st_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
{
if (size > (cs->data_size - cs->end))
@@ -2335,6 +2384,7 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs)
@@ -2332,6 +2379,7 @@ static void wined3d_cs_st_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
static const struct wined3d_cs_ops wined3d_cs_st_ops =
{
@ -91,19 +100,15 @@ index 8dea530b413..fc67672fff2 100644
wined3d_cs_st_require_space,
wined3d_cs_st_submit,
wined3d_cs_st_finish,
@@ -2363,6 +2413,23 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs)
SetEvent(cs->event);
@@ -2364,6 +2412,19 @@ static void wined3d_cs_mt_submit(struct wined3d_cs *cs, enum wined3d_cs_queue_id
wined3d_cs_queue_submit(&cs->queue[queue_id], cs);
}
+static BOOL wined3d_cs_mt_check_space(struct wined3d_cs *cs, size_t size, int priority)
+static BOOL wined3d_cs_queue_check_space(struct wined3d_cs_queue *queue, size_t size)
+{
+ struct wined3d_cs_queue *queue = priority ? &cs->prio_queue : &cs->norm_queue;
+ size_t queue_size = ARRAY_SIZE(queue->data);
+ size_t header_size, packet_size, remaining;
+
+ if (cs->thread_id == GetCurrentThreadId())
+ return wined3d_cs_st_check_space(cs, size, priority);
+
+ header_size = FIELD_OFFSET(struct wined3d_cs_packet, data[0]);
+ size = (size + header_size - 1) & ~(header_size - 1);
+ packet_size = FIELD_OFFSET(struct wined3d_cs_packet, data[size]);
@ -112,10 +117,25 @@ index 8dea530b413..fc67672fff2 100644
+ return (remaining >= packet_size);
+}
+
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, int priority)
static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size_t size, struct wined3d_cs *cs)
{
struct wined3d_cs_queue *queue = priority ? &cs->prio_queue : &cs->norm_queue;
@@ -2444,6 +2511,7 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs)
size_t queue_size = ARRAY_SIZE(queue->data);
@@ -2425,6 +2486,14 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size
return packet->data;
}
+static BOOL wined3d_cs_mt_check_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
+{
+ if (cs->thread_id == GetCurrentThreadId())
+ return wined3d_cs_st_check_space(cs, size, queue_id);
+
+ return wined3d_cs_queue_check_space(&cs->queue[queue_id], size);
+}
+
static void *wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id)
{
if (cs->thread_id == GetCurrentThreadId())
@@ -2444,6 +2513,7 @@ static void wined3d_cs_mt_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id
static const struct wined3d_cs_ops wined3d_cs_mt_ops =
{
@ -124,10 +144,10 @@ index 8dea530b413..fc67672fff2 100644
wined3d_cs_mt_submit,
wined3d_cs_mt_finish,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1e17106cddc..adf6ded131f 100644
index fa01f8a15e0..0a638ecf19a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4287,8 +4287,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4298,8 +4298,6 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
TRACE("device %p, resource %p, sub_resource_idx %u, box %s, data %p, row_pitch %u, depth_pitch %u.\n",
device, resource, sub_resource_idx, debug_box(box), data, row_pitch, depth_pitch);
@ -137,17 +157,17 @@ index 1e17106cddc..adf6ded131f 100644
{
if (sub_resource_idx > 0)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b647f4e23b4..093f33eee77 100644
index 6920b29329f..b6f0dd3a90c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3267,6 +3267,7 @@ struct wined3d_cs_queue
@@ -3318,6 +3318,7 @@ struct wined3d_cs_queue
struct wined3d_cs_ops
{
+ BOOL (*check_space)(struct wined3d_cs *cs, size_t size, int priority);
void *(*require_space)(struct wined3d_cs *cs, size_t size, int priority);
void (*submit)(struct wined3d_cs *cs);
void (*finish)(struct wined3d_cs *cs);
+ BOOL (*check_space)(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id);
void *(*require_space)(struct wined3d_cs *cs, size_t size, enum wined3d_cs_queue_id queue_id);
void (*submit)(struct wined3d_cs *cs, enum wined3d_cs_queue_id queue_id);
void (*finish)(struct wined3d_cs *cs, enum wined3d_cs_queue_id queue_id);
--
2.12.2

File diff suppressed because it is too large Load Diff