Rebase against d7e4193df2f22a87031e44ce358a626a5f92b295.

FIXME: Should destroy_default_sampler() also be called from delete_opengl_contexts() in the non-CSMT case?
This commit is contained in:
Sebastian Lackner
2016-01-07 00:05:49 +01:00
parent ff0e7cc638
commit 98e45e14d9
12 changed files with 238 additions and 503 deletions

View File

@@ -1,4 +1,4 @@
From 55240026af497ef2d4e3d8edc456e65b989bf59e Mon Sep 17 00:00:00 2001
From c7d9b4666e695ab3c3c3589337108d221665152c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Wed, 2 Oct 2013 12:36:02 +0200
Subject: wined3d: Don't request the frontbuffer to create dummy textures.
@@ -8,10 +8,10 @@ Subject: wined3d: Don't request the frontbuffer to create dummy textures.
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6f82385..f5cb7bd 100644
index ea125c2..0977e12 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -905,8 +905,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -991,8 +991,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
device->swapchains[0] = swapchain;
device_init_swapchain_state(device, swapchain);
@@ -20,7 +20,7 @@ index 6f82385..f5cb7bd 100644
+ context = context_acquire(device, NULL);
create_dummy_textures(device, context);
create_default_sampler(device);
--
2.1.3
2.6.4

View File

@@ -1,4 +1,4 @@
From c91b5281332e1879e25088efeee24bc1a337ca30 Mon Sep 17 00:00:00 2001
From 410c5748849a9467bd5ee302ea96a20bd770f059 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Thu, 10 Oct 2013 16:29:42 +0200
Subject: wined3d: Create dummy textures through the CS.
@@ -6,16 +6,16 @@ Subject: wined3d: Create dummy textures through the CS.
Hacky version. Just good enough to see if the double context during init is what makes fglrx
crash.
---
dlls/wined3d/cs.c | 29 +++++++++++++++++++++++++++++
dlls/wined3d/device.c | 13 ++++---------
dlls/wined3d/wined3d_private.h | 3 ++-
3 files changed, 35 insertions(+), 10 deletions(-)
dlls/wined3d/cs.c | 30 ++++++++++++++++++++++++++++++
dlls/wined3d/device.c | 17 ++++++-----------
dlls/wined3d/wined3d_private.h | 4 +++-
3 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 5e4aa53..fb1d1aa 100644
index bd83689..383c9a5 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -87,6 +87,7 @@ enum wined3d_cs_op
@@ -88,6 +88,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_VOLUME_CLEANUP,
WINED3D_CS_OP_SURFACE_CLEANUP,
WINED3D_CS_OP_TEXTURE_CLEANUP,
@@ -23,7 +23,7 @@ index 5e4aa53..fb1d1aa 100644
WINED3D_CS_OP_STOP,
};
@@ -512,6 +513,11 @@ struct wined3d_cs_texture_cleanup
@@ -522,6 +523,11 @@ struct wined3d_cs_texture_cleanup
struct wined3d_texture *texture;
};
@@ -35,7 +35,7 @@ index 5e4aa53..fb1d1aa 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2473,6 +2479,28 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
@@ -2587,6 +2593,29 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
cs->ops->submit(cs, sizeof(*op));
}
@@ -45,6 +45,7 @@ index 5e4aa53..fb1d1aa 100644
+ struct wined3d_context *context = context_acquire(cs->device, NULL);
+
+ device_create_dummy_textures(cs->device, context);
+ device_create_default_sampler(cs->device);
+
+ context_release(context);
+ return sizeof(*op);
@@ -64,7 +65,7 @@ index 5e4aa53..fb1d1aa 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2538,6 +2566,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2653,6 +2682,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_VOLUME_CLEANUP */ wined3d_cs_exec_volume_cleanup,
/* WINED3D_CS_OP_SURFACE_CLEANUP */ wined3d_cs_exec_surface_cleanup,
/* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
@@ -73,10 +74,10 @@ index 5e4aa53..fb1d1aa 100644
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index b3f75ba..28b1c81 100644
index c479b80..04a36a2 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -608,7 +608,7 @@ out:
@@ -651,7 +651,7 @@ out:
}
/* Context activation is done by the caller. */
@@ -85,7 +86,16 @@ index b3f75ba..28b1c81 100644
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
unsigned int i, j, count;
@@ -854,7 +854,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -758,7 +758,7 @@ static void destroy_dummy_textures(struct wined3d_device *device, const struct w
}
/* Context activation is done by the caller. */
-static void create_default_sampler(struct wined3d_device *device)
+void device_create_default_sampler(struct wined3d_device *device)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -940,7 +940,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
{
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
struct wined3d_swapchain *swapchain = NULL;
@@ -93,18 +103,20 @@ index b3f75ba..28b1c81 100644
DWORD clear_flags = 0;
HRESULT hr;
@@ -905,9 +904,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -991,10 +990,8 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
device->swapchains[0] = swapchain;
device_init_swapchain_state(device, swapchain);
- context = context_acquire(device, NULL);
-
- create_dummy_textures(device, context);
- create_default_sampler(device);
+ /* also calls create_default_sampler */
+ wined3d_cs_emit_create_dummy_textures(device->cs);
device->contexts[0]->last_was_rhw = 0;
@@ -919,7 +916,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -1006,7 +1003,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
case ORM_BACKBUFFER:
{
@@ -113,7 +125,7 @@ index b3f75ba..28b1c81 100644
{
TRACE("Using auxiliary buffer for offscreen rendering\n");
device->offscreenBuffer = GL_AUX0;
@@ -935,8 +932,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
@@ -1022,8 +1019,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
TRACE("All defaults now set up, leaving 3D init.\n");
@@ -122,7 +134,7 @@ index b3f75ba..28b1c81 100644
/* Clear the screen */
if (swapchain->back_buffers && swapchain->back_buffers[0])
clear_flags |= WINED3DCLEAR_TARGET;
@@ -4236,7 +4231,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
@@ -4503,7 +4498,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
swapchain->context[0] = context;
swapchain->num_contexts = 1;
@@ -132,19 +144,20 @@ index b3f75ba..28b1c81 100644
return WINED3D_OK;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2f8cab4..a4e1886 100644
index d187c0a..f9ffece 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2076,7 +2076,7 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT
@@ -2198,7 +2198,8 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT
GLenum type_hint, struct wined3d_context *context) DECLSPEC_HIDDEN;
void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo,
const struct wined3d_context *context) DECLSPEC_HIDDEN;
-
+void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
+void device_create_default_sampler(struct wined3d_device *device);
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2715,6 +2715,7 @@ void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer
@@ -2837,6 +2838,7 @@ void wined3d_cs_emit_buffer_cleanup(struct wined3d_cs *cs, struct wined3d_buffer
void wined3d_cs_emit_volume_cleanup(struct wined3d_cs *cs, struct wined3d_volume *volume) DECLSPEC_HIDDEN;
void wined3d_cs_emit_surface_cleanup(struct wined3d_cs *cs, struct wined3d_surface *surface) DECLSPEC_HIDDEN;
void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_texture *texture) DECLSPEC_HIDDEN;
@@ -153,5 +166,5 @@ index 2f8cab4..a4e1886 100644
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
--
2.1.3
2.6.4

View File

@@ -1,4 +1,4 @@
From 2fa4aafc16726b74a32cfcfae23d68749545114f Mon Sep 17 00:00:00 2001
From e97fb065249c11f83234e5d8b713112725fc3039 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 11 Oct 2013 10:11:13 +0200
Subject: wined3d: Delete GL contexts through the CS in reset.
@@ -11,10 +11,10 @@ Let's see if this fixes the remaining fglrx crashes...
3 files changed, 48 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 3662432..489fad0 100644
index b0b86ae..b30bb4e 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -89,6 +89,7 @@ enum wined3d_cs_op
@@ -90,6 +90,7 @@ enum wined3d_cs_op
WINED3D_CS_OP_TEXTURE_CLEANUP,
WINED3D_CS_OP_CREATE_DUMMY_TEXTURES,
WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT,
@@ -22,7 +22,7 @@ index 3662432..489fad0 100644
WINED3D_CS_OP_STOP,
};
@@ -526,6 +527,12 @@ struct wined3d_cs_create_swapchain_context
@@ -536,6 +537,12 @@ struct wined3d_cs_create_swapchain_context
HRESULT *ret;
};
@@ -35,7 +35,7 @@ index 3662432..489fad0 100644
static void wined3d_cs_mt_submit(struct wined3d_cs *cs, size_t size)
{
LONG new_val = (cs->queue.head + size) & (WINED3D_CS_QUEUE_SIZE - 1);
@@ -2534,6 +2541,27 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
@@ -2649,6 +2656,27 @@ HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs, struct w
return ret;
}
@@ -63,7 +63,7 @@ index 3662432..489fad0 100644
static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void *data) =
{
/* WINED3D_CS_OP_NOP */ wined3d_cs_exec_nop,
@@ -2601,6 +2629,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
@@ -2717,6 +2745,7 @@ static UINT (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void
/* WINED3D_CS_OP_TEXTURE_CLEANUP */ wined3d_cs_exec_texture_cleanup,
/* WINED3D_CS_OP_CREATE_DUMMY_TEXTURES */ wined3d_cs_exec_create_dummy_textures,
/* WINED3D_CS_OP_CREATE_SWAPCHAIN_CONTEXT */ wined3d_cs_exec_create_swapchain_context,
@@ -72,10 +72,10 @@ index 3662432..489fad0 100644
static inline void *_wined3d_cs_mt_require_space(struct wined3d_cs *cs, size_t size, BOOL prio)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a113e21..b96f20f 100644
index 525b61b..039b645 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4142,22 +4142,12 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
@@ -4409,22 +4409,12 @@ void CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device)
}
}
@@ -99,7 +99,7 @@ index a113e21..b96f20f 100644
LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry)
{
device->shader_backend->shader_destroy(shader);
@@ -4187,6 +4177,20 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
@@ -4454,6 +4444,20 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
swapchain->context = NULL;
}
@@ -121,19 +121,19 @@ index a113e21..b96f20f 100644
{
HRESULT hr;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ab38f0e..2f7dd75 100644
index d5b939c..9f509e5 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2077,6 +2077,8 @@ struct wined3d_gl_bo *wined3d_device_get_bo(struct wined3d_device *device, UINT
void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_bo *bo,
@@ -2200,6 +2200,8 @@ void wined3d_device_release_bo(struct wined3d_device *device, struct wined3d_gl_
const struct wined3d_context *context) DECLSPEC_HIDDEN;
void device_create_dummy_textures(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
void device_create_default_sampler(struct wined3d_device *device);
+void device_delete_opengl_contexts_cs(struct wined3d_device *device,
+ struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD state)
{
@@ -2718,6 +2720,8 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
@@ -2841,6 +2843,8 @@ void wined3d_cs_emit_texture_cleanup(struct wined3d_cs *cs, struct wined3d_textu
void wined3d_cs_emit_create_dummy_textures(struct wined3d_cs *cs) DECLSPEC_HIDDEN;
HRESULT wined3d_cs_emit_create_swapchain_context(struct wined3d_cs *cs,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
@@ -143,5 +143,5 @@ index ab38f0e..2f7dd75 100644
/* Direct3D terminology with little modifications. We do not have an issued state
* because only the driver knows about it, but we have a created state because d3d
--
2.1.3
2.6.4

View File

@@ -1,17 +1,17 @@
From b596845e64e0d1f5d0674508066409f8eb88bed1 Mon Sep 17 00:00:00 2001
From 166fc2ef37010a9e368cd25a1ee2d3e722c087ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20D=C3=B6singer?= <stefan@codeweavers.com>
Date: Fri, 11 Oct 2013 10:17:42 +0200
Subject: wined3d: Delete GL contexts through the CS in uninit_3d.
---
dlls/wined3d/device.c | 32 +++-----------------------------
1 file changed, 3 insertions(+), 29 deletions(-)
dlls/wined3d/device.c | 34 ++++------------------------------
1 file changed, 4 insertions(+), 30 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 15868f2..d20d3b1 100644
index 039b645..8941632 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1013,8 +1013,6 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context)
@@ -1091,8 +1091,6 @@ static void device_free_sampler(struct wine_rb_entry *entry, void *context)
HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
{
struct wined3d_resource *resource, *cursor;
@@ -20,7 +20,7 @@ index 15868f2..d20d3b1 100644
struct wined3d_surface *surface;
UINT i;
@@ -1026,12 +1024,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1104,12 +1102,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
if (wined3d_settings.cs_multithreaded)
device->cs->ops->finish(device->cs);
@@ -33,7 +33,7 @@ index 15868f2..d20d3b1 100644
if (device->logo_texture)
wined3d_texture_decref(device->logo_texture);
@@ -1061,30 +1053,11 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1139,31 +1131,11 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
TRACE("Unloading resource %p.\n", resource);
wined3d_cs_emit_evict_resource(device->cs, resource);
}
@@ -55,6 +55,7 @@ index 15868f2..d20d3b1 100644
- device->blitter->free_private(device);
- device->shader_backend->shader_free_private(device);
- destroy_dummy_textures(device, gl_info);
- destroy_default_sampler(device);
-
- /* Release the context again as soon as possible. In particular,
- * releasing the render target views below may release the last reference
@@ -66,7 +67,15 @@ index 15868f2..d20d3b1 100644
if (device->back_buffer_view)
{
@@ -4366,6 +4339,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine
@@ -4432,6 +4404,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine
device->blitter->free_private(device);
device->shader_backend->shader_free_private(device);
destroy_dummy_textures(device, gl_info);
+ destroy_default_sampler(device);
context_release(context);
@@ -4442,6 +4415,7 @@ void device_delete_opengl_contexts_cs(struct wined3d_device *device, struct wine
HeapFree(GetProcessHeap(), 0, swapchain->context);
swapchain->context = NULL;
@@ -75,5 +84,5 @@ index 15868f2..d20d3b1 100644
static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
--
2.5.1
2.6.4

File diff suppressed because it is too large Load Diff