diff options
Diffstat (limited to 'firmware/target/hosted/android')
-rw-r--r-- | firmware/target/hosted/android/lcd-android.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/target/hosted/android/lcd-android.c b/firmware/target/hosted/android/lcd-android.c index 2bc6d04b9e..92e8f5b96f 100644 --- a/firmware/target/hosted/android/lcd-android.c +++ b/firmware/target/hosted/android/lcd-android.c | |||
@@ -39,11 +39,13 @@ static bool display_on; | |||
39 | static int dpi; | 39 | static int dpi; |
40 | static int scroll_threshold; | 40 | static int scroll_threshold; |
41 | static struct wakeup lcd_wakeup; | 41 | static struct wakeup lcd_wakeup; |
42 | static struct mutex lcd_mtx; | ||
42 | 43 | ||
43 | void lcd_init_device(void) | 44 | void lcd_init_device(void) |
44 | { | 45 | { |
45 | JNIEnv e = *env_ptr; | 46 | JNIEnv e = *env_ptr; |
46 | wakeup_init(&lcd_wakeup); | 47 | wakeup_init(&lcd_wakeup); |
48 | mutex_init(&lcd_mtx); | ||
47 | RockboxFramebuffer_class = e->FindClass(env_ptr, | 49 | RockboxFramebuffer_class = e->FindClass(env_ptr, |
48 | "org/rockbox/RockboxFramebuffer"); | 50 | "org/rockbox/RockboxFramebuffer"); |
49 | /* instantiate a RockboxFramebuffer instance | 51 | /* instantiate a RockboxFramebuffer instance |
@@ -114,8 +116,10 @@ void lcd_update(void) | |||
114 | /* tell the system we're ready for drawing */ | 116 | /* tell the system we're ready for drawing */ |
115 | if (display_on) | 117 | if (display_on) |
116 | { | 118 | { |
119 | mutex_lock(&lcd_mtx); | ||
117 | (*env_ptr)->CallVoidMethod(env_ptr, RockboxFramebuffer_instance, postInvalidate1); | 120 | (*env_ptr)->CallVoidMethod(env_ptr, RockboxFramebuffer_instance, postInvalidate1); |
118 | wakeup_wait(&lcd_wakeup, TIMEOUT_BLOCK); | 121 | wakeup_wait(&lcd_wakeup, TIMEOUT_BLOCK); |
122 | mutex_unlock(&lcd_mtx); | ||
119 | } | 123 | } |
120 | } | 124 | } |
121 | 125 | ||
@@ -123,9 +127,11 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
123 | { | 127 | { |
124 | if (display_on) | 128 | if (display_on) |
125 | { | 129 | { |
130 | mutex_lock(&lcd_mtx); | ||
126 | (*env_ptr)->CallVoidMethod(env_ptr, RockboxFramebuffer_instance, postInvalidate2, | 131 | (*env_ptr)->CallVoidMethod(env_ptr, RockboxFramebuffer_instance, postInvalidate2, |
127 | (jint)x, (jint)y, (jint)x+width, (jint)y+height); | 132 | (jint)x, (jint)y, (jint)x+width, (jint)y+height); |
128 | wakeup_wait(&lcd_wakeup, TIMEOUT_BLOCK); | 133 | wakeup_wait(&lcd_wakeup, TIMEOUT_BLOCK); |
134 | mutex_unlock(&lcd_mtx); | ||
129 | } | 135 | } |
130 | } | 136 | } |
131 | 137 | ||