Added patches to fix multiple regressions related to GDI rendering.

This commit is contained in:
Sebastian Lackner 2017-06-15 19:43:07 +02:00
parent f254a73e66
commit 8ebf6f58e5
7 changed files with 253 additions and 9 deletions

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "d7eb469d5992f9901b0dd355e5e61709aed31d2b"
echo "538e46adea88a3d6bdadd7f762eb620cd11cbeef"
}
# Show version information
@ -432,6 +432,7 @@ patch_enable_all ()
enable_wined3d_CSMT_Helper="$1"
enable_wined3d_CSMT_Main="$1"
enable_wined3d_DXTn="$1"
enable_wined3d_GDI_Rendering="$1"
enable_wined3d_GTX_560M="$1"
enable_wined3d_Limit_Vram="$1"
enable_wined3d_QUERY_Stubs="$1"
@ -1540,6 +1541,9 @@ patch_enable ()
wined3d-DXTn)
enable_wined3d_DXTn="$2"
;;
wined3d-GDI_Rendering)
enable_wined3d_GDI_Rendering="$2"
;;
wined3d-GTX_560M)
enable_wined3d_GTX_560M="$2"
;;
@ -9124,6 +9128,25 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-GDI_Rendering
# |
# | Modified files:
# | * dlls/wined3d/context.c, dlls/wined3d/device.c, dlls/wined3d/surface.c, dlls/wined3d/texture.c,
# | dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_GDI_Rendering" -eq 1; then
patch_apply wined3d-GDI_Rendering/0001-wined3d-Avoid-NULL-pointer-dereference-when-using-GD.patch
patch_apply wined3d-GDI_Rendering/0002-wined3d-Create-CPU-blitter-also-for-GDI-render.patch
patch_apply wined3d-GDI_Rendering/0003-wined3d-Fix-memory-leaks-in-blitter_destroy-callback.patch
patch_apply wined3d-GDI_Rendering/0004-wined3d-Trigger-frontbuffer-update-in-surface_cpu_bl.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Avoid NULL pointer dereference when using GDI renderer.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Create CPU blitter also for GDI render.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Fix memory leaks in blitter_destroy callbacks.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "wined3d: Trigger frontbuffer update in surface_cpu_blt.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-GTX_560M
# |
# | Modified files:

View File

@ -188,7 +188,7 @@ diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1224,6 +1224,9 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
@@ -1233,6 +1233,9 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
wine_rb_clear(&device->samplers, device_free_sampler, NULL);
@ -198,7 +198,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_device_delete_opengl_contexts(device);
if (device->fb.depth_stencil)
@@ -4165,6 +4168,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4176,6 +4179,7 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
return WINED3DERR_INVALIDCALL;
}
@ -206,7 +206,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);
@@ -4175,6 +4179,19 @@ HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *dev
@@ -4186,6 +4190,19 @@ 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;
@ -226,7 +226,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
}
if (!src_box)
@@ -4268,8 +4285,10 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
@@ -4279,8 +4296,10 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
return;
}
@ -237,7 +237,7 @@ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
wined3d_cs_emit_update_sub_resource(device->cs, resource, sub_resource_idx, box, data, row_pitch, depth_pitch);
}
@@ -5218,3 +5237,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
@@ -5229,3 +5248,58 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
else
return CallWindowProcA(proc, window, message, wparam, lparam);
}
@ -512,7 +512,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
if (resource->type == WINED3D_RTYPE_TEXTURE_2D)
{
@@ -2969,7 +3041,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -2981,7 +3053,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
}
else if (sub_resource->locations & WINED3D_LOCATION_BUFFER)
{
@ -524,7 +524,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
wined3d_texture_bind_and_dirtify(texture, context,
location == WINED3D_LOCATION_TEXTURE_SRGB);
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
@@ -3015,7 +3091,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
@@ -3027,7 +3103,11 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
case WINED3D_LOCATION_BUFFER:
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
@ -536,7 +536,7 @@ diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
@@ -3233,8 +3313,19 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
@@ -3245,8 +3325,19 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
if (dst_texture->sub_resources[dst_sub_resource_idx].map_count
|| src_texture->sub_resources[src_sub_resource_idx].map_count)
{

View File

@ -0,0 +1,48 @@
From 9dc3f3172083cf450ad72c3a8294f592c70e9114 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Jun 2017 16:01:04 +0200
Subject: wined3d: Avoid NULL pointer dereference when using GDI renderer.
Fixes a regression introduced in 62ca4f38269139ef2a8b9842ec538d9e7f7a0e76.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wined3d/context.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 0f6054226b..fbc73ca9a1 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2703,12 +2703,13 @@ void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint
void *context_map_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *data, size_t size, GLenum binding, DWORD flags)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
+ const struct wined3d_gl_info *gl_info;
BYTE *memory;
if (!data->buffer_object)
return data->addr;
+ gl_info = context->gl_info;
context_bind_bo(context, binding, data->buffer_object);
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
@@ -2731,11 +2732,12 @@ void *context_map_bo_address(struct wined3d_context *context,
void context_unmap_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *data, GLenum binding)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
+ const struct wined3d_gl_info *gl_info;
if (!data->buffer_object)
return;
+ gl_info = context->gl_info;
context_bind_bo(context, binding, data->buffer_object);
GL_EXTCALL(glUnmapBuffer(binding));
context_bind_bo(context, binding, 0);
--
2.13.1

View File

@ -0,0 +1,44 @@
From e18e871d92506bae4647566f55841db205d61475 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Jun 2017 16:01:34 +0200
Subject: wined3d: Create CPU blitter also for GDI render.
Fixes a regression introduced in cad4badbcf25992e0c61521aa15e639c2611f5d6.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wined3d/device.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ded4af6616..3d12e417a4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1164,6 +1164,15 @@ HRESULT CDECL wined3d_device_init_gdi(struct wined3d_device *device,
goto err_out;
}
device->swapchains[0] = swapchain;
+
+ if (!(device->blitter = wined3d_cpu_blitter_create()))
+ {
+ ERR("Failed to create CPU blitter.\n");
+ HeapFree(GetProcessHeap(), 0, device->swapchains);
+ device->swapchain_count = 0;
+ goto err_out;
+ }
+
return WINED3D_OK;
err_out:
@@ -1252,6 +1261,8 @@ HRESULT CDECL wined3d_device_uninit_gdi(struct wined3d_device *device)
{
unsigned int i;
+ device->blitter->ops->blitter_destroy(device->blitter, NULL);
+
for (i = 0; i < device->swapchain_count; ++i)
{
TRACE("Releasing the implicit swapchain %u.\n", i);
--
2.13.1

View File

@ -0,0 +1,44 @@
From bb63fe5dc5aec0dc8fec304f1d7ce790f684dfce Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Jun 2017 16:01:58 +0200
Subject: wined3d: Fix memory leaks in blitter_destroy callbacks.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wined3d/surface.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index abdeb9cac0..af8b5b4cb3 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2394,6 +2394,8 @@ static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
+
+ HeapFree(GetProcessHeap(), 0, blitter);
}
static void fbo_blitter_clear(struct wined3d_blitter *blitter, struct wined3d_device *device,
@@ -2476,6 +2478,8 @@ static void ffp_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
+
+ HeapFree(GetProcessHeap(), 0, blitter);
}
static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info,
@@ -2766,6 +2770,8 @@ static void cpu_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_
if ((next = blitter->next))
next->ops->blitter_destroy(next, context);
+
+ HeapFree(GetProcessHeap(), 0, blitter);
}
static HRESULT surface_cpu_blt_compressed(const BYTE *src_data, BYTE *dst_data,
--
2.13.1

View File

@ -0,0 +1,84 @@
From 4bc32d1d59b90666b20523e692e9cfc724eacecd Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 16 Jun 2017 16:03:22 +0200
Subject: wined3d: Trigger frontbuffer update in surface_cpu_blt.
Fixes a regression introduced in ee17d7ba1b72b26baae90c1d5e2ae5b3e4721654.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
---
dlls/wined3d/surface.c | 3 +++
dlls/wined3d/texture.c | 22 +++++++++++++++++-----
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index af8b5b4cb3..88ae765e17 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3343,6 +3343,9 @@ release:
context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER);
if (!same_sub_resource)
context_unmap_bo_address(context, &src_data, GL_PIXEL_UNPACK_BUFFER);
+
+ swapchain_frontbuffer_updated(dst_texture, dst_sub_resource_idx, dst_box);
+
if (converted_texture)
wined3d_texture_decref(converted_texture);
if (context)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 476295cecc..9de8b93c5a 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1979,6 +1979,22 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
return WINED3D_OK;
}
+void swapchain_frontbuffer_updated(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ const struct wined3d_box *box)
+{
+ struct wined3d_texture_sub_resource *sub_resource;
+
+ if (!texture->swapchain || texture->swapchain->front_buffer != texture)
+ return;
+ if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx)))
+ return;
+ if (sub_resource->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB))
+ return;
+
+ if (box) SetRect(&texture->swapchain->front_buffer_update, box->left, box->top, box->right, box->bottom);
+ texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(texture->swapchain);
+}
+
static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
{
struct wined3d_texture_sub_resource *sub_resource;
@@ -2010,11 +2026,7 @@ static HRESULT texture_resource_sub_resource_unmap(struct wined3d_resource *reso
if (context)
context_release(context);
- if (texture->swapchain && texture->swapchain->front_buffer == texture)
- {
- if (!(sub_resource->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB)))
- texture->swapchain->swapchain_ops->swapchain_frontbuffer_updated(texture->swapchain);
- }
+ swapchain_frontbuffer_updated(texture, sub_resource_idx, NULL);
--sub_resource->map_count;
if (!--resource->map_count && texture->update_map_binding)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 1025c98f18..e394931573 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3686,6 +3686,8 @@ void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HI
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void swapchain_update_swap_interval(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
+void swapchain_frontbuffer_updated(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+ const struct wined3d_box *box) DECLSPEC_HIDDEN;
/*****************************************************************************
* Utility function prototypes
--
2.13.1

View File

@ -0,0 +1 @@
Fixes: Multiple regression fixes for GDI rendering