mutex init
authorMateusz Majewski <m.majewski2@samsung.com>
Wed, 5 Feb 2025 07:48:15 +0000 (08:48 +0100)
committerMateusz Majewski <m.majewski2@samsung.com>
Fri, 28 Feb 2025 08:18:34 +0000 (09:18 +0100)
Change-Id: I5ee04c4d0de5bfb8a9ecf455957de6f3805548a7

tizen/src/ui/qt5.c
tizen/src/ui/qt5_supplement.cpp
tizen/src/ui/qt5_supplement.h

index 91ae8f5aa57526618ae0571a351b979287d545d8..a9ff9553121fcbc7408b3efcdc07907e6de9cfc2 100644 (file)
@@ -390,6 +390,9 @@ void maru_qt5_display_init(DisplayState *ds, int full_screen)
     }
     qt5_num_outputs = i;
     qt5_console = g_new0(struct qt5_state, qt5_num_outputs);
+#ifdef CONFIG_OPENGL
+    qt5_gl_init_items();
+#endif
     for (i = 0; i < qt5_num_outputs; i++) {
         QemuConsole *con = qemu_console_lookup_by_index(i);
 #ifdef CONFIG_OPENGL
index f37c1145b3bd09a7e2150ec4d6b370e94afcb356..22ebc58ca0915da1fbcc240bdee20ced4192679c 100644 (file)
@@ -615,6 +615,21 @@ void qt5_update_texture(void *dpy_item)
 static dpy_item dpy_item_pool[DPY_ITEM_NO];
 static uint64_t dpy_item_gen[DPY_ITEM_NO];
 
+void qt5_gl_init_items()
+{
+    for (int i = 0; i < DPY_ITEM_NO; ++i) {
+        qemu_mutex_init(&dpy_item_pool[i].mutex);
+        dpy_item_pool[i].available = true;
+    }
+}
+// TODO: Is there a good place to put this?
+/* void qt5_gl_destroy_items()
+{
+    for (int i = 0; i < DPY_ITEM_NO; ++i) {
+        qemu_mutex_destroy(&dpy_item_pool[i].mutex);
+    }
+} */
+
 uint32_t qt5_gl_refresh_internal(uint32_t tex, uint32_t width, uint32_t height, uint64_t gen, bool *should_free)
 {
     uint32_t ret = tex;
@@ -626,7 +641,7 @@ uint32_t qt5_gl_refresh_internal(uint32_t tex, uint32_t width, uint32_t height,
         {
             auto item = &dpy_item_pool[item_id];
             qemu_mutex_lock(&item->mutex);
-            bool ok = dpy_item_gen[item_id] == 0 || item->available;
+            bool ok = item->available;
             if (ok) {
                 ret = item->tex;
                 if (dpy_item_gen[item_id] != gen || /* HACK HACK HACK */ item->tex < 25) {
index b3431674efbdedc19145d29219447f46499aa34d..80a66f57403d0dfa12d0bfef6747df6ff180cd60 100644 (file)
@@ -64,6 +64,8 @@ const char* qt5_get_version(void);
 void qt5_set_force_legacy(bool isLegacy);
 
 #ifdef CONFIG_OPENGL
+void qt5_gl_init_items(void);
+// void qt5_gl_destroy_items(void);
 uint32_t qt5_gl_refresh_internal(uint32_t tex, uint32_t width, uint32_t height, uint64_t gen, bool *should_free);
 void *qt5_gl_create_context_internal(int major, int minor);
 void qt5_gl_destroy_context_internal(void *);