Alexandre Julliard : wineandroid: Implement LOCK/UNLOCK perform() functions on top of the buffer management calls.

Alexandre Julliard julliard at winehq.org
Tue Jun 6 15:23:27 CDT 2017


Module: wine
Branch: master
Commit: 1e46722c675f73e64009726ecdf857644416ba60
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1e46722c675f73e64009726ecdf857644416ba60

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun  6 08:31:38 2017 +0200

wineandroid: Implement LOCK/UNLOCK perform() functions on top of the buffer management calls.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wineandroid.drv/device.c | 51 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/dlls/wineandroid.drv/device.c b/dlls/wineandroid.drv/device.c
index 9212562..fdcf24a 100644
--- a/dlls/wineandroid.drv/device.c
+++ b/dlls/wineandroid.drv/device.c
@@ -1210,7 +1210,58 @@ static int perform( ANativeWindow *window, int operation, ... )
         break;
     }
     case NATIVE_WINDOW_LOCK:
+    {
+        struct ANativeWindowBuffer *buffer;
+        struct ANativeWindow_Buffer *buffer_ret = va_arg( args, ANativeWindow_Buffer * );
+        ARect *bounds = va_arg( args, ARect * );
+        int ret = window->dequeueBuffer_DEPRECATED( window, &buffer );
+        if (!ret)
+        {
+            if (gralloc_module)
+            {
+                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 );
+                }
+            }
+            else
+                buffer_ret->bits = ((struct native_buffer_wrapper *)buffer)->bits;
+        }
+        if (!ret)
+        {
+            buffer_ret->width  = buffer->width;
+            buffer_ret->height = buffer->height;
+            buffer_ret->stride = buffer->stride;
+            buffer_ret->format = buffer->format;
+            win->locked_buffer = buffer;
+            if (bounds)
+            {
+                bounds->left   = 0;
+                bounds->top    = 0;
+                bounds->right  = buffer->width;
+                bounds->bottom = buffer->height;
+            }
+        }
+        va_end( args );
+        TRACE( "hwnd %p %s bits %p ret %d %s\n", win->hwnd, names[operation], buffer_ret->bits, ret, strerror(-ret) );
+        return ret;
+    }
     case NATIVE_WINDOW_UNLOCK_AND_POST:
+    {
+        int ret = -EINVAL;
+        if (win->locked_buffer)
+        {
+            if (gralloc_module) gralloc_module->unlock( gralloc_module, win->locked_buffer->handle );
+            ret = window->queueBuffer( window, win->locked_buffer, -1 );
+            win->locked_buffer = NULL;
+        }
+        va_end( args );
+        TRACE( "hwnd %p %s ret %d\n", win->hwnd, names[operation], ret );
+        return ret;
+    }
     case NATIVE_WINDOW_CONNECT:
     case NATIVE_WINDOW_DISCONNECT:
         TRACE( "hwnd %p %s\n", win->hwnd, names[operation] );




More information about the wine-cvs mailing list