winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
November 2018
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
951 discussions
Start a n
N
ew thread
Alexandre Julliard : wineandroid: Add support for gralloc version 1.
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: 5b16fb9689f668f51f05868158e2d7833843097e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5b16fb9689f668f51f058681…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Nov 19 16:07:48 2018 +0100 wineandroid: Add support for gralloc version 1. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=44245
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wineandroid.drv/android_native.h | 83 +++++++++++++++++++++++++++++++++++ dlls/wineandroid.drv/device.c | 76 +++++++++++++++++++++++++++++--- 2 files changed, 152 insertions(+), 7 deletions(-) diff --git a/dlls/wineandroid.drv/android_native.h b/dlls/wineandroid.drv/android_native.h index 5efd564..fc26beb 100644 --- a/dlls/wineandroid.drv/android_native.h +++ b/dlls/wineandroid.drv/android_native.h @@ -230,4 +230,87 @@ enum gralloc_usage extern int hw_get_module(const char *id, const struct hw_module_t **module); +typedef enum +{ + GRALLOC1_CAPABILITY_INVALID = 0, + GRALLOC1_CAPABILITY_TEST_ALLOCATE = 1, + GRALLOC1_CAPABILITY_LAYERED_BUFFERS = 2, + GRALLOC1_CAPABILITY_RELEASE_IMPLY_DELETE = 3, + GRALLOC1_LAST_CAPABILITY = 3, +} gralloc1_capability_t; + +typedef enum +{ + GRALLOC1_FUNCTION_INVALID = 0, + GRALLOC1_FUNCTION_DUMP = 1, + GRALLOC1_FUNCTION_CREATE_DESCRIPTOR = 2, + GRALLOC1_FUNCTION_DESTROY_DESCRIPTOR = 3, + GRALLOC1_FUNCTION_SET_CONSUMER_USAGE = 4, + GRALLOC1_FUNCTION_SET_DIMENSIONS = 5, + GRALLOC1_FUNCTION_SET_FORMAT = 6, + GRALLOC1_FUNCTION_SET_PRODUCER_USAGE = 7, + GRALLOC1_FUNCTION_GET_BACKING_STORE = 8, + GRALLOC1_FUNCTION_GET_CONSUMER_USAGE = 9, + GRALLOC1_FUNCTION_GET_DIMENSIONS = 10, + GRALLOC1_FUNCTION_GET_FORMAT = 11, + GRALLOC1_FUNCTION_GET_PRODUCER_USAGE = 12, + GRALLOC1_FUNCTION_GET_STRIDE = 13, + GRALLOC1_FUNCTION_ALLOCATE = 14, + GRALLOC1_FUNCTION_RETAIN = 15, + GRALLOC1_FUNCTION_RELEASE = 16, + GRALLOC1_FUNCTION_GET_NUM_FLEX_PLANES = 17, + GRALLOC1_FUNCTION_LOCK = 18, + GRALLOC1_FUNCTION_LOCK_FLEX = 19, + GRALLOC1_FUNCTION_UNLOCK = 20, + GRALLOC1_FUNCTION_SET_LAYER_COUNT = 21, + GRALLOC1_FUNCTION_GET_LAYER_COUNT = 22, + GRALLOC1_FUNCTION_VALIDATE_BUFFER_SIZE = 23, + GRALLOC1_FUNCTION_GET_TRANSPORT_SIZE = 24, + GRALLOC1_FUNCTION_IMPORT_BUFFER = 25, + GRALLOC1_LAST_FUNCTION = 25, +} gralloc1_function_descriptor_t; + +typedef enum +{ + GRALLOC1_ERROR_NONE = 0, + GRALLOC1_ERROR_BAD_DESCRIPTOR = 1, + GRALLOC1_ERROR_BAD_HANDLE = 2, + GRALLOC1_ERROR_BAD_VALUE = 3, + GRALLOC1_ERROR_NOT_SHARED = 4, + GRALLOC1_ERROR_NO_RESOURCES = 5, + GRALLOC1_ERROR_UNDEFINED = 6, + GRALLOC1_ERROR_UNSUPPORTED = 7, +} gralloc1_error_t; + +typedef enum +{ + GRALLOC1_PRODUCER_USAGE_NONE = 0, + GRALLOC1_PRODUCER_USAGE_CPU_READ = 1u << 1, + GRALLOC1_PRODUCER_USAGE_CPU_READ_OFTEN = 1u << 2 | GRALLOC1_PRODUCER_USAGE_CPU_READ, + GRALLOC1_PRODUCER_USAGE_CPU_WRITE = 1u << 5, + GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN = 1u << 6 | GRALLOC1_PRODUCER_USAGE_CPU_WRITE, +} gralloc1_producer_usage_t; + +typedef enum +{ + GRALLOC1_CONSUMER_USAGE_NONE = 0, + GRALLOC1_CONSUMER_USAGE_CPU_READ = 1u << 1, + GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN = 1u << 2 | GRALLOC1_CONSUMER_USAGE_CPU_READ, +} gralloc1_consumer_usage_t; + +typedef struct gralloc1_device +{ + struct hw_device_t common; + void (*getCapabilities)(struct gralloc1_device *device, uint32_t *outCount, int32_t *outCapabilities); + void* (*getFunction)(struct gralloc1_device *device, int32_t descriptor); +} gralloc1_device_t; + +typedef struct gralloc1_rect +{ + int32_t left; + int32_t top; + int32_t width; + int32_t height; +} gralloc1_rect_t; + #endif /* __WINE_ANDROID_NATIVE_H */ diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c index a6f2838..c0ff072 100644 --- a/dlls/wineandroid.drv/device.c +++ b/dlls/wineandroid.drv/device.c @@ -213,6 +213,17 @@ struct ioctl_android_set_capture }; static struct gralloc_module_t *gralloc_module; +static struct gralloc1_device *gralloc1_device; +static BOOL gralloc1_caps[GRALLOC1_LAST_CAPABILITY + 1]; + +static gralloc1_error_t (*gralloc1_retain)( gralloc1_device_t *device, buffer_handle_t buffer ); +static gralloc1_error_t (*gralloc1_release)( gralloc1_device_t *device, buffer_handle_t buffer ); +static gralloc1_error_t (*gralloc1_lock)( gralloc1_device_t *device, buffer_handle_t buffer, + uint64_t producerUsage, uint64_t consumerUsage, + const gralloc1_rect_t *accessRegion, void **outData, + int32_t acquireFence ); +static gralloc1_error_t (*gralloc1_unlock)( gralloc1_device_t *device, buffer_handle_t buffer, + int32_t *outReleaseFence ); static inline BOOL is_in_desktop_process(void) { @@ -328,7 +339,7 @@ static native_handle_t *unmap_native_handle( const native_handle_t *src ) if (!is_in_desktop_process()) { - dest = HeapAlloc( GetProcessHeap(), 0, size ); + dest = malloc( size ); memcpy( dest, src, size ); /* fetch file descriptors passed from the server process */ for (i = 0; i < dest->numFds; i++) @@ -344,7 +355,7 @@ static void close_native_handle( native_handle_t *handle ) int i; for (i = 0; i < handle->numFds; i++) close( handle->data[i] ); - HeapFree( GetProcessHeap(), 0, handle ); + free( handle ); } /* insert a buffer index at the head of the LRU list */ @@ -500,15 +511,49 @@ void register_native_window( HWND hwnd, struct ANativeWindow *win, BOOL opengl ) void init_gralloc( const struct hw_module_t *module ) { + struct hw_device_t *device; + int ret; + TRACE( "got module %p ver %u.%u id %s name %s author %s\n", module, module->module_api_version >> 8, module->module_api_version & 0xff, debugstr_a(module->id), debugstr_a(module->name), debugstr_a(module->author) ); - gralloc_module = (struct gralloc_module_t *)module; + switch (module->module_api_version >> 8) + { + case 0: + gralloc_module = (struct gralloc_module_t *)module; + break; + case 1: + if (!(ret = module->methods->open( module, GRALLOC_HARDWARE_MODULE_ID, &device ))) + { + int32_t caps[64]; + uint32_t i, count = ARRAY_SIZE(caps); + + gralloc1_device = (struct gralloc1_device *)device; + gralloc1_retain = gralloc1_device->getFunction( gralloc1_device, GRALLOC1_FUNCTION_RETAIN ); + gralloc1_release = gralloc1_device->getFunction( gralloc1_device, GRALLOC1_FUNCTION_RELEASE ); + gralloc1_lock = gralloc1_device->getFunction( gralloc1_device, GRALLOC1_FUNCTION_LOCK ); + gralloc1_unlock = gralloc1_device->getFunction( gralloc1_device, GRALLOC1_FUNCTION_UNLOCK ); + TRACE( "got device version %u funcs %p %p %p %p\n", device->version, + gralloc1_retain, gralloc1_release, gralloc1_lock, gralloc1_unlock ); + + gralloc1_device->getCapabilities( gralloc1_device, &count, caps ); + if (count == ARRAY_SIZE(caps)) ERR( "too many gralloc capabilities\n" ); + for (i = 0; i < count; i++) + if (caps[i] < ARRAY_SIZE(gralloc1_caps)) gralloc1_caps[caps[i]] = TRUE; + } + else ERR( "failed to open gralloc err %d\n", ret ); + break; + default: + ERR( "unknown gralloc module version %u\n", module->module_api_version >> 8 ); + break; + } } static int gralloc_grab_buffer( struct ANativeWindowBuffer *buffer ) { + if (gralloc1_device) + return gralloc1_retain( gralloc1_device, buffer->handle ); if (gralloc_module) return gralloc_module->registerBuffer( gralloc_module, buffer->handle ); return -ENODEV; @@ -516,12 +561,23 @@ static int gralloc_grab_buffer( struct ANativeWindowBuffer *buffer ) static void gralloc_release_buffer( struct ANativeWindowBuffer *buffer ) { - if (gralloc_module) gralloc_module->unregisterBuffer( gralloc_module, buffer->handle ); - close_native_handle( (native_handle_t *)buffer->handle ); + if (gralloc1_device) gralloc1_release( gralloc1_device, buffer->handle ); + else if (gralloc_module) gralloc_module->unregisterBuffer( gralloc_module, buffer->handle ); + + if (!gralloc1_caps[GRALLOC1_CAPABILITY_RELEASE_IMPLY_DELETE]) + close_native_handle( (native_handle_t *)buffer->handle ); } static int gralloc_lock( struct ANativeWindowBuffer *buffer, void **bits ) { + if (gralloc1_device) + { + gralloc1_rect_t rect = { 0, 0, buffer->width, buffer->height }; + return gralloc1_lock( gralloc1_device, buffer->handle, + GRALLOC1_PRODUCER_USAGE_CPU_READ_OFTEN | + GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN, + GRALLOC1_CONSUMER_USAGE_NONE, &rect, bits, -1 ); + } if (gralloc_module) return gralloc_module->lock( gralloc_module, buffer->handle, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, @@ -533,7 +589,13 @@ static int gralloc_lock( struct ANativeWindowBuffer *buffer, void **bits ) static void gralloc_unlock( struct ANativeWindowBuffer *buffer ) { - if (gralloc_module) gralloc_module->unlock( gralloc_module, buffer->handle ); + if (gralloc1_device) + { + int fence; + gralloc1_unlock( gralloc1_device, buffer->handle, &fence ); + wait_fence_and_close( fence ); + } + else if (gralloc_module) gralloc_module->unlock( gralloc_module, buffer->handle ); } /* get the capture window stored in the desktop process */ @@ -1133,7 +1195,7 @@ static int dequeueBuffer( struct ANativeWindow *window, struct ANativeWindowBuff struct native_win_wrapper *win = (struct native_win_wrapper *)window; struct ioctl_android_dequeueBuffer res; DWORD size = sizeof(res); - int ret, use_win32 = !gralloc_module; + int ret, use_win32 = !gralloc_module && !gralloc1_device; res.hdr.hwnd = HandleToLong( win->hwnd ); res.hdr.opengl = win->opengl;
1
0
0
0
Alexandre Julliard : wineandroid: Add helper functions to encapsulate gralloc functionality.
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: 18ac6bf41a640449161cae4f8371aeda169fb4bb URL:
https://source.winehq.org/git/wine.git/?a=commit;h=18ac6bf41a640449161cae4f…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Nov 19 16:06:51 2018 +0100 wineandroid: Add helper functions to encapsulate gralloc functionality. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wineandroid.drv/android.h | 3 +- dlls/wineandroid.drv/device.c | 72 +++++++++++++++++++++++++++++------------- dlls/wineandroid.drv/init.c | 14 ++++---- 3 files changed, 59 insertions(+), 30 deletions(-) diff --git a/dlls/wineandroid.drv/android.h b/dlls/wineandroid.drv/android.h index 2a9ac81..b218a9b 100644 --- a/dlls/wineandroid.drv/android.h +++ b/dlls/wineandroid.drv/android.h @@ -88,6 +88,7 @@ enum android_window_messages WM_ANDROID_REFRESH = 0x80001000, }; +extern void init_gralloc( const struct hw_module_t *module ) DECLSPEC_HIDDEN; extern HWND get_capture_window(void) DECLSPEC_HIDDEN; extern void init_monitors( int width, int height ) DECLSPEC_HIDDEN; extern void set_screen_dpi( DWORD dpi ) DECLSPEC_HIDDEN; @@ -155,6 +156,4 @@ int send_event( const union event_data *data ); extern JavaVM *wine_get_java_vm(void); extern jobject wine_get_java_object(void); -extern struct gralloc_module_t *gralloc_module; - #endif /* __WINE_ANDROID_H */ diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c index 328f2fa..a6f2838 100644 --- a/dlls/wineandroid.drv/device.c +++ b/dlls/wineandroid.drv/device.c @@ -212,6 +212,8 @@ struct ioctl_android_set_capture struct ioctl_header hdr; }; +static struct gralloc_module_t *gralloc_module; + static inline BOOL is_in_desktop_process(void) { return thread != NULL; @@ -496,6 +498,44 @@ void register_native_window( HWND hwnd, struct ANativeWindow *win, BOOL opengl ) NtQueueApcThread( thread, register_native_window_callback, (ULONG_PTR)hwnd, (ULONG_PTR)win, opengl ); } +void init_gralloc( const struct hw_module_t *module ) +{ + TRACE( "got module %p ver %u.%u id %s name %s author %s\n", + module, module->module_api_version >> 8, module->module_api_version & 0xff, + debugstr_a(module->id), debugstr_a(module->name), debugstr_a(module->author) ); + + gralloc_module = (struct gralloc_module_t *)module; +} + +static int gralloc_grab_buffer( struct ANativeWindowBuffer *buffer ) +{ + if (gralloc_module) + return gralloc_module->registerBuffer( gralloc_module, buffer->handle ); + return -ENODEV; +} + +static void gralloc_release_buffer( struct ANativeWindowBuffer *buffer ) +{ + if (gralloc_module) gralloc_module->unregisterBuffer( gralloc_module, buffer->handle ); + close_native_handle( (native_handle_t *)buffer->handle ); +} + +static int gralloc_lock( struct ANativeWindowBuffer *buffer, void **bits ) +{ + if (gralloc_module) + return gralloc_module->lock( gralloc_module, buffer->handle, + GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, + 0, 0, buffer->width, buffer->height, bits ); + + *bits = ((struct native_buffer_wrapper *)buffer)->bits; + return 0; +} + +static void gralloc_unlock( struct ANativeWindowBuffer *buffer ) +{ + if (gralloc_module) gralloc_module->unlock( gralloc_module, buffer->handle ); +} + /* get the capture window stored in the desktop process */ HWND get_capture_window(void) { @@ -740,12 +780,10 @@ static NTSTATUS queueBuffer_ioctl( void *data, DWORD in_size, DWORD out_size, UL if (win_data->mappings[res->buffer_id]) { void *bits; - int ret = gralloc_module->lock( gralloc_module, buffer->handle, - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, - 0, 0, buffer->width, buffer->height, &bits ); + ret = gralloc_lock( buffer, &bits ); if (ret) return android_error_to_status( ret ); memcpy( bits, win_data->mappings[res->buffer_id], buffer->stride * buffer->height * 4 ); - gralloc_module->unlock( gralloc_module, buffer->handle ); + gralloc_unlock( buffer ); } wrap_java_call(); ret = parent->queueBuffer( parent, buffer, -1 ); @@ -1084,11 +1122,7 @@ static void buffer_decRef( struct android_native_base_t *base ) if (!InterlockedDecrement( &buffer->ref )) { - if (!is_in_desktop_process()) - { - if (gralloc_module) gralloc_module->unregisterBuffer( gralloc_module, buffer->buffer.handle ); - close_native_handle( (native_handle_t *)buffer->buffer.handle ); - } + if (!is_in_desktop_process()) gralloc_release_buffer( &buffer->buffer ); if (buffer->bits) UnmapViewOfFile( buffer->bits ); HeapFree( GetProcessHeap(), 0, buffer ); } @@ -1140,8 +1174,9 @@ static int dequeueBuffer( struct ANativeWindow *window, struct ANativeWindowBuff } else if (!is_in_desktop_process()) { - if ((ret = gralloc_module->registerBuffer( gralloc_module, buf->buffer.handle )) < 0) - WARN( "hwnd %p, buffer %p failed to register %d %s\n", win->hwnd, &buf->buffer, ret, strerror(-ret) ); + if ((ret = gralloc_grab_buffer( &buf->buffer )) < 0) + WARN( "hwnd %p, buffer %p failed to register %d %s\n", + win->hwnd, &buf->buffer, ret, strerror(-ret) ); } } @@ -1313,18 +1348,11 @@ static int perform( ANativeWindow *window, int operation, ... ) int ret = window->dequeueBuffer_DEPRECATED( window, &buffer ); if (!ret) { - if (gralloc_module) + if ((ret = gralloc_lock( buffer, &buffer_ret->bits ))) { - if ((ret = gralloc_module->lock( gralloc_module, buffer->handle, - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, - 0, 0, buffer->width, buffer->height, &buffer_ret->bits ))) - { - WARN( "gralloc->lock %p failed %d %s\n", win->hwnd, ret, strerror(-ret) ); - window->cancelBuffer( window, buffer, -1 ); - } + WARN( "gralloc->lock %p failed %d %s\n", win->hwnd, ret, strerror(-ret) ); + window->cancelBuffer( window, buffer, -1 ); } - else - buffer_ret->bits = ((struct native_buffer_wrapper *)buffer)->bits; } if (!ret) { @@ -1350,7 +1378,7 @@ static int perform( ANativeWindow *window, int operation, ... ) int ret = -EINVAL; if (win->locked_buffer) { - if (gralloc_module) gralloc_module->unlock( gralloc_module, win->locked_buffer->handle ); + gralloc_unlock( win->locked_buffer ); ret = window->queueBuffer( window, win->locked_buffer, -1 ); win->locked_buffer = NULL; } diff --git a/dlls/wineandroid.drv/init.c b/dlls/wineandroid.drv/init.c index d199696..b5c85ee 100644 --- a/dlls/wineandroid.drv/init.c +++ b/dlls/wineandroid.drv/init.c @@ -450,8 +450,6 @@ DECL_FUNCPTR( ANativeWindow_fromSurface ); DECL_FUNCPTR( ANativeWindow_release ); DECL_FUNCPTR( hw_get_module ); -struct gralloc_module_t *gralloc_module = NULL; - #ifndef DT_GNU_HASH #define DT_GNU_HASH 0x6ffffef5 #endif @@ -564,6 +562,7 @@ static int enum_libs( struct dl_phdr_info* info, size_t size, void* data ) static void load_hardware_libs(void) { const struct hw_module_t *module; + int ret; void *libhardware; char error[256]; @@ -589,10 +588,13 @@ static void load_hardware_libs(void) } } - if (phw_get_module( GRALLOC_HARDWARE_MODULE_ID, &module ) == 0) - gralloc_module = (struct gralloc_module_t *)module; - else - ERR( "failed to load gralloc module\n" ); + if ((ret = phw_get_module( GRALLOC_HARDWARE_MODULE_ID, &module ))) + { + ERR( "failed to load gralloc module err %d\n", ret ); + return; + } + + init_gralloc( module ); } static void load_android_libs(void)
1
0
0
0
Alexandre Julliard : winedbg: Remove some redundant length arguments.
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: a4fbe12f972dfda0a344def6717bf1d27966984b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a4fbe12f972dfda0a344def6…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Mon Nov 19 15:24:10 2018 +0100 winedbg: Remove some redundant length arguments. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/gdbproxy.c | 96 +++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 56 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=a4fbe12f972dfda0a344…
1
0
0
0
Nikolay Sivov : server: Use base class atom for child window enumeration.
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: b5f179655ca8eacdb6ed9b4471bf55362789c1e9 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=b5f179655ca8eacdb6ed9b44…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Nov 19 16:08:47 2018 +0300 server: Use base class atom for child window enumeration. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/class.c | 4 ---- server/class.c | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c index 6c5850f..d6910d9 100644 --- a/dlls/user32/tests/class.c +++ b/dlls/user32/tests/class.c @@ -1354,11 +1354,9 @@ static void test_actctx_classes(void) ok(hwnd != NULL, "Failed to create a window.\n"); hwnd2 = FindWindowExA(NULL, NULL, "MyTestClass", NULL); -todo_wine ok(hwnd2 == hwnd, "Failed to find test window.\n"); hwnd2 = FindWindowExA(NULL, NULL, "4.3.2.1!MyTestClass", NULL); -todo_wine ok(hwnd2 == NULL, "Unexpected find result %p.\n", hwnd2); ret = GetClassNameA(hwnd, buff, sizeof(buff)); @@ -1390,11 +1388,9 @@ todo_wine ok(hwnd != NULL, "Failed to create a window.\n"); hwnd2 = FindWindowExA(NULL, NULL, "MyTestClass", NULL); -todo_wine ok(hwnd2 == hwnd, "Failed to find test window.\n"); hwnd2 = FindWindowExA(NULL, NULL, "4.3.2.1!MyTestClass", NULL); -todo_wine ok(hwnd2 == NULL, "Unexpected find result %p.\n", hwnd2); DestroyWindow(hwnd); diff --git a/server/class.c b/server/class.c index 6a7de78..403180d 100644 --- a/server/class.c +++ b/server/class.c @@ -139,7 +139,7 @@ int is_hwnd_message_class( struct window_class *class ) atom_t get_class_atom( struct window_class *class ) { - return class->atom; + return class->base_atom; } client_ptr_t get_class_client_ptr( struct window_class *class )
1
0
0
0
Nikolay Sivov : user32/tests: Add FindWindow() test for versioned class.
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: e8897ebe4ec60408d1d774bf1e4fe0b45549c00b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=e8897ebe4ec60408d1d774bf…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Mon Nov 19 16:08:46 2018 +0300 user32/tests: Add FindWindow() test for versioned class. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/tests/class.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c index 5db37d4a..6c5850f 100644 --- a/dlls/user32/tests/class.c +++ b/dlls/user32/tests/class.c @@ -1319,7 +1319,7 @@ static void test_actctx_classes(void) ATOM class; HINSTANCE hinst; char buff[64]; - HWND hwnd; + HWND hwnd, hwnd2; char path[MAX_PATH]; GetTempPathA(ARRAY_SIZE(path), path); @@ -1353,6 +1353,14 @@ static void test_actctx_classes(void) hwnd = CreateWindowExA(0, testclass, "test", 0, 0, 0, 0, 0, 0, 0, hinst, 0); ok(hwnd != NULL, "Failed to create a window.\n"); + hwnd2 = FindWindowExA(NULL, NULL, "MyTestClass", NULL); +todo_wine + ok(hwnd2 == hwnd, "Failed to find test window.\n"); + + hwnd2 = FindWindowExA(NULL, NULL, "4.3.2.1!MyTestClass", NULL); +todo_wine + ok(hwnd2 == NULL, "Unexpected find result %p.\n", hwnd2); + ret = GetClassNameA(hwnd, buff, sizeof(buff)); ok(ret, "Failed to get class name.\n"); ok(!strcmp(buff, testclass), "Unexpected class name.\n"); @@ -1378,6 +1386,19 @@ static void test_actctx_classes(void) DestroyWindow(hwnd); + hwnd = CreateWindowExA(0, "4.3.2.1!MyTestClass", "test", 0, 0, 0, 0, 0, 0, 0, hinst, 0); + ok(hwnd != NULL, "Failed to create a window.\n"); + + hwnd2 = FindWindowExA(NULL, NULL, "MyTestClass", NULL); +todo_wine + ok(hwnd2 == hwnd, "Failed to find test window.\n"); + + hwnd2 = FindWindowExA(NULL, NULL, "4.3.2.1!MyTestClass", NULL); +todo_wine + ok(hwnd2 == NULL, "Unexpected find result %p.\n", hwnd2); + + DestroyWindow(hwnd); + ret = UnregisterClassA("MyTestClass", hinst); ok(!ret, "Unexpected ret value %d.\n", ret);
1
0
0
0
Byeongsik Jeon : gdi32: Fix the linked child font bold, italic style correctly.
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: 590c8b82c810956e763d49f5dd9fac8c96a8ccc7 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=590c8b82c810956e763d49f5…
Author: Byeongsik Jeon <bsjeon(a)hanmail.net> Date: Tue Nov 13 18:38:03 2018 +0900 gdi32: Fix the linked child font bold, italic style correctly. Signed-off-by: Byeongsik Jeon <bsjeon(a)hanmail.net> Signed-off-by: Huw Davies <huw(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/freetype.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 99b7d8c..3fc41c3 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -8116,8 +8116,30 @@ static UINT freetype_GetOutlineTextMetrics( PHYSDEV dev, UINT cbSize, OUTLINETEX static BOOL load_child_font(GdiFont *font, CHILD_FONT *child) { + const struct list *face_list; + Face *child_face = NULL, *best_face = NULL; + UINT penalty = 0, new_penalty = 0; + BOOL bold, italic, bd, it; + + italic = font->font_desc.lf.lfItalic ? TRUE : FALSE; + bold = font->font_desc.lf.lfWeight > FW_MEDIUM ? TRUE : FALSE; + + face_list = get_face_list_from_family( child->face->family ); + LIST_FOR_EACH_ENTRY( child_face, face_list, Face, entry ) + { + it = child_face->ntmFlags & NTM_ITALIC ? TRUE : FALSE; + bd = child_face->ntmFlags & NTM_BOLD ? TRUE : FALSE; + new_penalty = ( it ^ italic ) + ( bd ^ bold ); + if (!best_face || new_penalty < penalty) + { + penalty = new_penalty; + best_face = child_face; + } + } + child_face = best_face ? best_face : child->face; + child->font = alloc_font(); - child->font->ft_face = OpenFontFace(child->font, child->face, 0, -font->ppem); + child->font->ft_face = OpenFontFace( child->font, child_face, 0, -font->ppem ); if(!child->font->ft_face) { free_font(child->font); @@ -8125,11 +8147,13 @@ static BOOL load_child_font(GdiFont *font, CHILD_FONT *child) return FALSE; } + child->font->fake_italic = italic && !( child_face->ntmFlags & NTM_ITALIC ); + child->font->fake_bold = bold && !( child_face->ntmFlags & NTM_BOLD ); child->font->font_desc = font->font_desc; - child->font->ntmFlags = child->face->ntmFlags; + child->font->ntmFlags = child_face->ntmFlags; child->font->orientation = font->orientation; child->font->scale_y = font->scale_y; - child->font->name = strdupW(child->face->family->FamilyName); + child->font->name = strdupW( child_face->family->FamilyName ); child->font->base_font = font; TRACE("created child font %p for base %p\n", child->font, font); return TRUE;
1
0
0
0
Henri Verbeet : d3dx9: Use a staging texture to update unmappable surfaces in D3DXLoadSurfaceFromMemory ().
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: 9ab14dff87c7d3ddae18d9e862cbe3edca81d8c0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9ab14dff87c7d3ddae18d9e8…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Sun Nov 18 22:27:19 2018 +0330 d3dx9: Use a staging texture to update unmappable surfaces in D3DXLoadSurfaceFromMemory(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3dx9_36/surface.c | 53 +++++++++++++++++++++++++++++++++---------- dlls/d3dx9_36/tests/surface.c | 1 - 2 files changed, 41 insertions(+), 13 deletions(-) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index a44398c..7d48cc6 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -1753,9 +1753,12 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, DWORD filter, D3DCOLOR color_key) { const struct pixel_format_desc *srcformatdesc, *destformatdesc; + IDirect3DSurface9 *surface = dst_surface; + IDirect3DDevice9 *device; D3DSURFACE_DESC surfdesc; D3DLOCKED_RECT lockrect; struct volume src_size, dst_size; + HRESULT hr; TRACE("(%p, %p, %s, %p, %#x, %u, %p, %s, %#x, 0x%08x)\n", dst_surface, dst_palette, wine_dbgstr_rect(dst_rect), src_memory, src_format, @@ -1811,6 +1814,26 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, return E_NOTIMPL; } + if (surfdesc.Pool == D3DPOOL_DEFAULT && !(surfdesc.Usage & D3DUSAGE_DYNAMIC)) + { + IDirect3DSurface9_GetDevice(dst_surface, &device); + hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, surfdesc.Width, + surfdesc.Height, surfdesc.Format, D3DPOOL_SYSTEMMEM, &surface, NULL); + IDirect3DDevice9_Release(device); + if (FAILED(hr)) + { + WARN("Failed to create staging surface, hr %#x.\n", hr); + return D3DERR_INVALIDCALL; + } + } + + if (FAILED(IDirect3DSurface9_LockRect(surface, &lockrect, dst_rect, 0))) + { + if (surface != dst_surface) + IDirect3DSurface9_Release(surface); + return D3DXERR_INVALIDDATA; + } + if (src_format == surfdesc.Format && dst_size.width == src_size.width && dst_size.height == src_size.height @@ -1824,16 +1847,12 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, && src_size.height != surfdesc.Height)) { WARN("Source rect %s is misaligned.\n", wine_dbgstr_rect(src_rect)); - return D3DXERR_INVALIDDATA; + hr = D3DXERR_INVALIDDATA; + goto done; } - if (FAILED(IDirect3DSurface9_LockRect(dst_surface, &lockrect, dst_rect, 0))) - return D3DXERR_INVALIDDATA; - copy_pixels(src_memory, src_pitch, 0, lockrect.pBits, lockrect.Pitch, 0, &src_size, srcformatdesc); - - IDirect3DSurface9_UnlockRect(dst_surface); } else /* Stretching or format conversion. */ { @@ -1841,12 +1860,10 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, || !is_conversion_to_supported(destformatdesc)) { FIXME("Unsupported format conversion %#x -> %#x.\n", src_format, surfdesc.Format); - return E_NOTIMPL; + hr = E_NOTIMPL; + goto done; } - if (FAILED(IDirect3DSurface9_LockRect(dst_surface, &lockrect, dst_rect, 0))) - return D3DXERR_INVALIDDATA; - if ((filter & 0xf) == D3DX_FILTER_NONE) { convert_argb_pixels(src_memory, src_pitch, 0, &src_size, srcformatdesc, @@ -1862,11 +1879,23 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface, point_filter_argb_pixels(src_memory, src_pitch, 0, &src_size, srcformatdesc, lockrect.pBits, lockrect.Pitch, 0, &dst_size, destformatdesc, color_key, src_palette); } + } - IDirect3DSurface9_UnlockRect(dst_surface); + hr = D3D_OK; +done: + IDirect3DSurface9_UnlockRect(surface); + if (surface != dst_surface) + { + if (SUCCEEDED(hr)) + { + IDirect3DSurface9_GetDevice(dst_surface, &device); + hr = IDirect3DDevice9_UpdateSurface(device, surface, NULL, dst_surface, NULL); + IDirect3DDevice9_Release(device); + } + IDirect3DSurface9_Release(surface); } - return D3D_OK; + return hr; } /************************************************************ diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index 469c864..f153cd9 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -867,7 +867,6 @@ static void test_D3DXLoadSurface(IDirect3DDevice9 *device) ok(hr == D3D_OK, "IDirect3DDevice9_GetRenderTarget returned %#x, expected %#x.\n", hr, D3D_OK); hr = D3DXLoadSurfaceFromSurface(newsurf, NULL, NULL, surf, NULL, NULL, D3DX_FILTER_NONE, 0); - todo_wine ok(hr == D3D_OK, "D3DXLoadSurfaceFromSurface returned %#x, expected %#x.\n", hr, D3D_OK); hr = D3DXLoadSurfaceFromSurface(surf, NULL, NULL, newsurf, NULL, NULL, D3DX_FILTER_NONE, 0); todo_wine
1
0
0
0
Henri Verbeet : wined3d: Disallow dynamic rendertarget and depth/ stencil resources.
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: 9bac6f159c975ec151c87627cf9e6383566164e8 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=9bac6f159c975ec151c87627…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Sun Nov 18 22:27:18 2018 +0330 wined3d: Disallow dynamic rendertarget and depth/stencil resources. Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/tests/device.c | 7 ++++--- dlls/d3d9/tests/device.c | 7 ++++--- dlls/ddraw/surface.c | 4 +++- dlls/wined3d/resource.c | 20 +++++++++++++++----- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 59eec65..c07e981 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -8944,7 +8944,7 @@ static void test_resource_access(void) case SURFACE_2D: hr = IDirect3DDevice8_CreateTexture(device, 16, 16, 1, tests[j].usage, format, tests[j].pool, &texture_2d); - todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30) + todo_wine_if(!tests[j].valid && tests[j].format == FORMAT_DEPTH && !tests[j].usage) ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_2d) ? D3D_OK : D3DERR_INVALIDCALL), "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); @@ -8959,7 +8959,7 @@ static void test_resource_access(void) case SURFACE_CUBE: hr = IDirect3DDevice8_CreateCubeTexture(device, 16, 1, tests[j].usage, format, tests[j].pool, &texture_cube); - todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30) + todo_wine_if(!tests[j].valid && tests[j].format == FORMAT_DEPTH && !tests[j].usage) ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_cube) ? D3D_OK : D3DERR_INVALIDCALL), "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); @@ -9091,7 +9091,8 @@ static void test_resource_access(void) hr = IDirect3DDevice8_CreateVolumeTexture(device, 16, 16, 1, 1, tests[i].usage, format, tests[i].pool, &texture); - todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET && tests[i].pool == D3DPOOL_DEFAULT) + todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET + && !(tests[i].usage & D3DUSAGE_DYNAMIC) && tests[i].pool == D3DPOOL_DEFAULT) ok(hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) ? D3D_OK : D3DERR_INVALIDCALL), "Test %u: Got unexpected hr %#x.\n", i, hr); if (FAILED(hr)) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index f3b9a0a..9f293a8 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -12774,7 +12774,7 @@ static void test_resource_access(void) case SURFACE_2D: hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1, tests[j].usage, format, tests[j].pool, &texture_2d, NULL); - todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30) + todo_wine_if(!tests[j].valid && tests[j].format == FORMAT_DEPTH && !tests[j].usage) ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_2d) ? D3D_OK : D3DERR_INVALIDCALL), "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); @@ -12789,7 +12789,7 @@ static void test_resource_access(void) case SURFACE_CUBE: hr = IDirect3DDevice9_CreateCubeTexture(device, 16, 1, tests[j].usage, format, tests[j].pool, &texture_cube, NULL); - todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30) + todo_wine_if(!tests[j].valid && tests[j].format == FORMAT_DEPTH && !tests[j].usage) ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_cube) ? D3D_OK : D3DERR_INVALIDCALL), "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); @@ -12926,7 +12926,8 @@ static void test_resource_access(void) hr = IDirect3DDevice9_CreateVolumeTexture(device, 16, 16, 1, 1, tests[i].usage, format, tests[i].pool, &texture, NULL); - todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET && tests[i].pool == D3DPOOL_DEFAULT) + todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET + && !(tests[i].usage & D3DUSAGE_DYNAMIC) && tests[i].pool == D3DPOOL_DEFAULT) ok(hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) ? D3D_OK : D3DERR_INVALIDCALL), "Test %u: Got unexpected hr %#x.\n", i, hr); if (FAILED(hr)) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 7c13cbf..8190442 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6189,7 +6189,9 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ /* Videomemory adds localvidmem. This is mutually exclusive with * systemmemory and texturemanage. */ desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM; - wined3d_desc.usage |= WINED3DUSAGE_DYNAMIC; + /* Dynamic resources can't be written by the GPU. */ + if (!(wined3d_desc.bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL))) + wined3d_desc.usage |= WINED3DUSAGE_DYNAMIC; } } diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index e5016e4..82e9019 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -91,12 +91,22 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * return WINED3DERR_INVALIDCALL; } - if ((access & (WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_GPU)) != WINED3D_RESOURCE_ACCESS_GPU - && bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL)) + if (bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL)) { - WARN("Bind flags %s are incompatible with resource access %s.\n", - wined3d_debug_bind_flags(bind_flags), wined3d_debug_resource_access(access)); - return WINED3DERR_INVALIDCALL; + if ((access & (WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_GPU)) != WINED3D_RESOURCE_ACCESS_GPU) + { + WARN("Bind flags %s are incompatible with resource access %s.\n", + wined3d_debug_bind_flags(bind_flags), wined3d_debug_resource_access(access)); + return WINED3DERR_INVALIDCALL; + } + + /* Dynamic usage is incompatible with GPU writes. */ + if (usage & WINED3DUSAGE_DYNAMIC) + { + WARN("Bind flags %s are incompatible with resource usage %s.\n", + wined3d_debug_bind_flags(bind_flags), debug_d3dusage(usage)); + return WINED3DERR_INVALIDCALL; + } } if (!size)
1
0
0
0
Henri Verbeet : wined3d: Require exclusive GPU access for rendertarget and depth/ stencil resources.
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: 0bae2bed43a2178114c737e113ff4a5e63ebd82b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0bae2bed43a2178114c737e1…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Sun Nov 18 22:27:17 2018 +0330 wined3d: Require exclusive GPU access for rendertarget and depth/stencil resources. Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/tests/device.c | 9 +++------ dlls/d3d9/tests/device.c | 9 +++------ dlls/wined3d/resource.c | 8 ++++++++ dlls/wined3d/texture.c | 2 -- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 0b40253..59eec65 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -8944,8 +8944,7 @@ static void test_resource_access(void) case SURFACE_2D: hr = IDirect3DDevice8_CreateTexture(device, 16, 16, 1, tests[j].usage, format, tests[j].pool, &texture_2d); - todo_wine_if(j == 10 || j == 13 || j == 16 || j == 17 || j == 20 || j == 23 || j == 24 - || j == 27 || j == 30 || j == 31 || j == 32 || j == 33 || j == 34) + todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30) ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_2d) ? D3D_OK : D3DERR_INVALIDCALL), "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); @@ -8960,8 +8959,7 @@ static void test_resource_access(void) case SURFACE_CUBE: hr = IDirect3DDevice8_CreateCubeTexture(device, 16, 1, tests[j].usage, format, tests[j].pool, &texture_cube); - todo_wine_if(j == 10 || j == 13 || j == 16 || j == 17 || j == 20 || j == 23 || j == 24 - || j == 27 || j == 30 || j == 31 || j == 32 || j == 33 || j == 34) + todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30) ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_cube) ? D3D_OK : D3DERR_INVALIDCALL), "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); @@ -9093,8 +9091,7 @@ static void test_resource_access(void) hr = IDirect3DDevice8_CreateVolumeTexture(device, 16, 16, 1, 1, tests[i].usage, format, tests[i].pool, &texture); - todo_wine_if((tests[i].usage & D3DUSAGE_DEPTHSTENCIL && tests[i].pool == D3DPOOL_SCRATCH) - || tests[i].usage & D3DUSAGE_RENDERTARGET) + todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET && tests[i].pool == D3DPOOL_DEFAULT) ok(hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) ? D3D_OK : D3DERR_INVALIDCALL), "Test %u: Got unexpected hr %#x.\n", i, hr); if (FAILED(hr)) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 4e620d5..f3b9a0a 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -12774,8 +12774,7 @@ static void test_resource_access(void) case SURFACE_2D: hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1, tests[j].usage, format, tests[j].pool, &texture_2d, NULL); - todo_wine_if(j == 10 || j == 13 || j == 16 || j == 17 || j == 20 || j == 23 || j == 24 - || j == 27 || j == 30 || j == 31 || j == 32 || j == 33 || j == 34) + todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30) ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_2d) ? D3D_OK : D3DERR_INVALIDCALL), "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); @@ -12790,8 +12789,7 @@ static void test_resource_access(void) case SURFACE_CUBE: hr = IDirect3DDevice9_CreateCubeTexture(device, 16, 1, tests[j].usage, format, tests[j].pool, &texture_cube, NULL); - todo_wine_if(j == 10 || j == 13 || j == 16 || j == 17 || j == 20 || j == 23 || j == 24 - || j == 27 || j == 30 || j == 31 || j == 32 || j == 33 || j == 34) + todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30) ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_cube) ? D3D_OK : D3DERR_INVALIDCALL), "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); @@ -12928,8 +12926,7 @@ static void test_resource_access(void) hr = IDirect3DDevice9_CreateVolumeTexture(device, 16, 16, 1, 1, tests[i].usage, format, tests[i].pool, &texture, NULL); - todo_wine_if((tests[i].usage & D3DUSAGE_DEPTHSTENCIL && tests[i].pool == D3DPOOL_SCRATCH) - || tests[i].usage & D3DUSAGE_RENDERTARGET) + todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET && tests[i].pool == D3DPOOL_DEFAULT) ok(hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) ? D3D_OK : D3DERR_INVALIDCALL), "Test %u: Got unexpected hr %#x.\n", i, hr); if (FAILED(hr)) diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 30a35c7..e5016e4 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -91,6 +91,14 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * return WINED3DERR_INVALIDCALL; } + if ((access & (WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_GPU)) != WINED3D_RESOURCE_ACCESS_GPU + && bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL)) + { + WARN("Bind flags %s are incompatible with resource access %s.\n", + wined3d_debug_bind_flags(bind_flags), wined3d_debug_resource_access(access)); + return WINED3DERR_INVALIDCALL; + } + if (!size) ERR("Attempting to create a zero-sized resource.\n"); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index ee3754f..dbc256f 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -2909,8 +2909,6 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc if ((flags & WINED3D_TEXTURE_CREATE_MAPPABLE) && !((desc->usage & WINED3DUSAGE_DYNAMIC) || (desc->bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL)))) WARN("Creating a mappable texture that doesn't specify dynamic usage.\n"); - if (desc->bind_flags & WINED3D_BIND_RENDER_TARGET && desc->access & WINED3D_RESOURCE_ACCESS_CPU) - FIXME("Trying to create a CPU accessible render target.\n"); pow2_width = desc->width; pow2_height = desc->height;
1
0
0
0
Henri Verbeet : wined3d: Make "driver private" formats always mappable.
by Alexandre Julliard
19 Nov '18
19 Nov '18
Module: wine Branch: master Commit: 826be9ee109909e7c41d5bed2fb62fe4e74d4d05 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=826be9ee109909e7c41d5bed…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Sun Nov 18 22:27:16 2018 +0330 wined3d: Make "driver private" formats always mappable. Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d8/tests/device.c | 6 ++---- dlls/wined3d/resource.c | 2 ++ dlls/wined3d/texture.c | 2 +- dlls/wined3d/utils.c | 6 ++++-- dlls/wined3d/wined3d_private.h | 1 + 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 5669009..0b40253 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -9045,11 +9045,9 @@ static void test_resource_access(void) expected_hr = D3D_OK; else expected_hr = D3DERR_INVALIDCALL; - todo_wine_if(j == 1 && surface_types[i].type != SURFACE_IMAGE) - ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); + ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); hr = IDirect3DSurface8_UnlockRect(surface); - todo_wine_if((expected_hr != D3D_OK && surface_types[i].type == SURFACE_2D) - || (j == 1 && surface_types[i].type == SURFACE_CUBE)) + todo_wine_if(expected_hr != D3D_OK && surface_types[i].type == SURFACE_2D) ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr); if (SUCCEEDED(IDirect3DSurface8_GetContainer(surface, &IID_IDirect3DBaseTexture8, (void **)&texture))) diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 05fbafb..30a35c7 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -186,6 +186,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * resource->multisample_quality = multisample_quality; resource->usage = usage; resource->bind_flags = bind_flags; + if (resource->format_flags & WINED3DFMT_FLAG_MAPPABLE) + access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; resource->access = access; resource->width = width; resource->height = height; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 05f210f..ee3754f 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -3012,7 +3012,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc return hr; } wined3d_resource_update_draw_binding(&texture->resource); - if ((flags & WINED3D_TEXTURE_CREATE_MAPPABLE) || desc->format == WINED3DFMT_D16_LOCKABLE) + if (flags & WINED3D_TEXTURE_CREATE_MAPPABLE) texture->resource.access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; texture->texture_ops = texture_ops; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index a0abe6a..aa68799 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -328,8 +328,10 @@ struct wined3d_format_base_flags * resource size. */ static const struct wined3d_format_base_flags format_base_flags[] = { - {WINED3DFMT_ATI1N, WINED3DFMT_FLAG_BROKEN_PITCH}, - {WINED3DFMT_ATI2N, WINED3DFMT_FLAG_BROKEN_PITCH}, + {WINED3DFMT_ATI1N, WINED3DFMT_FLAG_MAPPABLE | WINED3DFMT_FLAG_BROKEN_PITCH}, + {WINED3DFMT_ATI2N, WINED3DFMT_FLAG_MAPPABLE | WINED3DFMT_FLAG_BROKEN_PITCH}, + {WINED3DFMT_D16_LOCKABLE, WINED3DFMT_FLAG_MAPPABLE}, + {WINED3DFMT_INTZ, WINED3DFMT_FLAG_MAPPABLE}, {WINED3DFMT_R11G11B10_FLOAT, WINED3DFMT_FLAG_FLOAT}, {WINED3DFMT_D32_FLOAT, WINED3DFMT_FLAG_FLOAT}, {WINED3DFMT_S8_UINT_D24_FLOAT, WINED3DFMT_FLAG_FLOAT}, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 2d2f712..f739e5f 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4401,6 +4401,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN #define WINED3DFMT_FLAG_NORMALISED 0x00800000 #define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000 #define WINED3DFMT_FLAG_BLIT 0x02000000 +#define WINED3DFMT_FLAG_MAPPABLE 0x04000000 struct wined3d_rational {
1
0
0
0
← Newer
1
...
54
55
56
57
58
59
60
...
96
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Results per page:
10
25
50
100
200