Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7aaa88f8
Commit
7aaa88f8
authored
Jun 04, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineandroid: Use pthread for locking in opengl.c.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
parent
47847a20
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
18 deletions
+20
-18
Makefile.in
dlls/wineandroid.drv/Makefile.in
+3
-2
android.h
dlls/wineandroid.drv/android.h
+2
-0
init.c
dlls/wineandroid.drv/init.c
+6
-0
opengl.c
dlls/wineandroid.drv/opengl.c
+9
-16
No files found.
dlls/wineandroid.drv/Makefile.in
View file @
7aaa88f8
EXTRADEFS
=
-DWINE_NO_LONG_TYPES
MODULE
=
wineandroid.drv
IMPORTS
=
user32 ntoskrnl win32u
MODULE
=
wineandroid.drv
IMPORTS
=
user32 ntoskrnl win32u
EXTRALIBS
=
$(PTHREAD_LIBS)
EXTRADLLFLAGS
=
-mcygwin
...
...
dlls/wineandroid.drv/android.h
View file @
7aaa88f8
...
...
@@ -24,6 +24,7 @@
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <pthread.h>
#include <jni.h>
#include <android/log.h>
#include <android/input.h>
...
...
@@ -51,6 +52,7 @@ DECL_FUNCPTR( ANativeWindow_release );
* OpenGL driver
*/
extern
pthread_mutex_t
drawable_mutex
DECLSPEC_HIDDEN
;
extern
void
update_gl_drawable
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
extern
void
destroy_gl_drawable
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
extern
struct
opengl_funcs
*
get_wgl_driver
(
UINT
version
)
DECLSPEC_HIDDEN
;
...
...
dlls/wineandroid.drv/init.c
View file @
7aaa88f8
...
...
@@ -558,6 +558,7 @@ unsigned short *p_java_gdt_sel = NULL;
static
BOOL
process_attach
(
void
)
{
pthread_mutexattr_t
attr
;
jclass
class
;
jobject
object
;
JNIEnv
*
jni_env
;
...
...
@@ -574,6 +575,11 @@ static BOOL process_attach(void)
load_hardware_libs
();
pthread_mutexattr_init
(
&
attr
);
pthread_mutexattr_settype
(
&
attr
,
PTHREAD_MUTEX_RECURSIVE
);
pthread_mutex_init
(
&
drawable_mutex
,
&
attr
);
pthread_mutexattr_destroy
(
&
attr
);
if
((
java_vm
=
*
p_java_vm
))
/* running under Java */
{
#ifdef __i386__
...
...
dlls/wineandroid.drv/opengl.c
View file @
7aaa88f8
...
...
@@ -105,14 +105,7 @@ static struct list gl_drawables = LIST_INIT( gl_drawables );
static
void
(
*
pglFinish
)(
void
);
static
void
(
*
pglFlush
)(
void
);
static
CRITICAL_SECTION
drawable_section
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
drawable_section
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": drawable_section"
)
}
};
static
CRITICAL_SECTION
drawable_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
pthread_mutex_t
drawable_mutex
;
static
inline
BOOL
is_onscreen_pixel_format
(
int
format
)
{
...
...
@@ -130,7 +123,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, HDC hdc, int format )
gl
->
window
=
create_ioctl_window
(
hwnd
,
TRUE
,
1
.
0
f
);
gl
->
surface
=
0
;
gl
->
pbuffer
=
p_eglCreatePbufferSurface
(
display
,
pixel_formats
[
gl
->
format
-
1
].
config
,
attribs
);
EnterCriticalSection
(
&
drawable_section
);
pthread_mutex_lock
(
&
drawable_mutex
);
list_add_head
(
&
gl_drawables
,
&
gl
->
entry
);
return
gl
;
}
...
...
@@ -139,26 +132,26 @@ static struct gl_drawable *get_gl_drawable( HWND hwnd, HDC hdc )
{
struct
gl_drawable
*
gl
;
EnterCriticalSection
(
&
drawable_section
);
pthread_mutex_lock
(
&
drawable_mutex
);
LIST_FOR_EACH_ENTRY
(
gl
,
&
gl_drawables
,
struct
gl_drawable
,
entry
)
{
if
(
hwnd
&&
gl
->
hwnd
==
hwnd
)
return
gl
;
if
(
hdc
&&
gl
->
hdc
==
hdc
)
return
gl
;
}
LeaveCriticalSection
(
&
drawable_section
);
pthread_mutex_unlock
(
&
drawable_mutex
);
return
NULL
;
}
static
void
release_gl_drawable
(
struct
gl_drawable
*
gl
)
{
if
(
gl
)
LeaveCriticalSection
(
&
drawable_section
);
if
(
gl
)
pthread_mutex_unlock
(
&
drawable_mutex
);
}
void
destroy_gl_drawable
(
HWND
hwnd
)
{
struct
gl_drawable
*
gl
;
EnterCriticalSection
(
&
drawable_section
);
pthread_mutex_lock
(
&
drawable_mutex
);
LIST_FOR_EACH_ENTRY
(
gl
,
&
gl_drawables
,
struct
gl_drawable
,
entry
)
{
if
(
gl
->
hwnd
!=
hwnd
)
continue
;
...
...
@@ -169,7 +162,7 @@ void destroy_gl_drawable( HWND hwnd )
HeapFree
(
GetProcessHeap
(),
0
,
gl
);
break
;
}
LeaveCriticalSection
(
&
drawable_section
);
pthread_mutex_unlock
(
&
drawable_mutex
);
}
static
BOOL
refresh_context
(
struct
wgl_context
*
ctx
)
...
...
@@ -439,9 +432,9 @@ static struct wgl_context * WINAPI android_wglCreateContext( HDC hdc )
*/
static
BOOL
WINAPI
android_wglDeleteContext
(
struct
wgl_context
*
ctx
)
{
EnterCriticalSection
(
&
drawable_section
);
pthread_mutex_lock
(
&
drawable_mutex
);
list_remove
(
&
ctx
->
entry
);
LeaveCriticalSection
(
&
drawable_section
);
pthread_mutex_unlock
(
&
drawable_mutex
);
p_eglDestroyContext
(
display
,
ctx
->
context
);
return
HeapFree
(
GetProcessHeap
(),
0
,
ctx
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment