VIGS/qt5: now working on win32 70/25970/1
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Wed, 13 Aug 2014 09:23:58 +0000 (13:23 +0400)
committerStanislav Vorobiov <s.vorobiov@samsung.com>
Wed, 13 Aug 2014 09:25:19 +0000 (13:25 +0400)
Change-Id: I8ffa1d5463d2c72377d419d733c1186856ca4f7d
Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
hw/vigs/vigs_device.c
hw/vigs/vigs_gl_backend.c
hw/vigs/vigs_gl_backend_glx.c
hw/vigs/vigs_gl_backend_wgl.c
hw/vigs/vigs_qt5.cpp
hw/vigs/vigs_qt5.h
tizen/src/display/qt5.c
tizen/src/ui/mainwindow.cpp

index 61dbb3709f967a19013ffd8e9049cac85a669828..90bd2af6aa8a2babc609d1afac0f27dc224674e1 100644 (file)
@@ -452,7 +452,7 @@ static int vigs_device_init(PCIDevice *dev)
         goto fail;
     }
 
-    if (vigs_qt5_display()) {
+    if (vigs_qt5_enabled()) {
         s->server = vigs_onscreen_server_create(memory_region_get_ram_ptr(&s->vram_bar),
                                                 memory_region_get_ram_ptr(&s->ram_bar),
                                                 &vigs_dpy_ops,
index 32e7df76290bc4dedce309cadf1debd27f84f7e0..e66eb0bc3d34d980d4a9e07d0727fc3103ba3ead 100644 (file)
@@ -1473,7 +1473,7 @@ static bool vigs_gl_backend_composite(struct vigs_surface *surface,
     VIGS_LOG_TRACE("enter");
 
     if (surface->ptr) {
-        if (!vigs_qt5_display() && !planes_dirty) {
+        if (!vigs_qt5_enabled() && !planes_dirty) {
             memcpy(display_data,
                    surface->ptr,
                    surface->stride * surface->ws_sfc->height);
@@ -1661,7 +1661,7 @@ static bool vigs_gl_backend_display(struct vigs_backend *backend,
 
     VIGS_LOG_TRACE("enter");
 
-    if (vigs_qt5_display()) {
+    if (vigs_qt5_enabled()) {
         GLfloat *vert_coords;
         GLfloat *tex_coords;
         bool scale;
index 23a485795680c4fbbdc6fe621aebebd3abff36ed..9b478dfc8dd48d399b37a5badac14ab8030843a4 100644 (file)
@@ -198,7 +198,7 @@ static GLXFBConfig vigs_gl_backend_glx_get_config(struct vigs_gl_backend_glx *gl
     GLXFBConfig *glx_configs;
     GLXFBConfig best_config = NULL;
 
-    if (vigs_qt5_display()) {
+    if (vigs_qt5_enabled()) {
         int config_attribs[] =
         {
             GLX_FBCONFIG_ID, 0,
@@ -385,7 +385,7 @@ static void vigs_gl_backend_glx_destroy(struct vigs_backend *backend)
         gl_backend_glx->glXDestroyPbuffer(gl_backend_glx->dpy,
                                           gl_backend_glx->read_pixels_sfc);
     }
-    if (!vigs_qt5_display() && gl_backend_glx->ctx) {
+    if (!vigs_qt5_enabled() && gl_backend_glx->ctx) {
         gl_backend_glx->glXDestroyContext(gl_backend_glx->dpy,
                                           gl_backend_glx->ctx);
     }
@@ -534,7 +534,7 @@ struct vigs_backend *vigs_gl_backend_create(void *display)
         VIGS_GL_GET_PROC(DeleteVertexArrays, glDeleteVertexArrays);
     }
 
-    if (vigs_qt5_display()) {
+    if (vigs_qt5_enabled()) {
         gl_backend_glx->ctx =
             (GLXContext)vigs_qt5_gl_context_create(gl_backend_glx->base.is_gl_2);
 
@@ -603,7 +603,7 @@ fail2:
         gl_backend_glx->glXDestroyPbuffer(gl_backend_glx->dpy,
                                           gl_backend_glx->read_pixels_sfc);
     }
-    if (!vigs_qt5_display() && gl_backend_glx->ctx) {
+    if (!vigs_qt5_enabled() && gl_backend_glx->ctx) {
         gl_backend_glx->glXDestroyContext(gl_backend_glx->dpy,
                                           gl_backend_glx->ctx);
     }
index 30eb634f4e47f08d44da446485fe73127d2713c5..488e2a6a2388813b5aa3894dd5b6474c5a5cb3c9 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "vigs_gl_backend.h"
 #include "vigs_log.h"
+#include "vigs_qt5.h"
 #include <windows.h>
 #include <wingdi.h>
 #include <GL/gl.h>
@@ -455,6 +456,7 @@ struct vigs_backend *vigs_gl_backend_create(void *display)
     };
     const char *ext_str = NULL;
     struct vigs_gl_backend_wgl *gl_backend_wgl = NULL;
+    HGLRC qt5_ctx = NULL;
 
     vigs_win_class.cbSize = sizeof(WNDCLASSEXA);
     vigs_win_class.style = 0;
@@ -652,6 +654,14 @@ struct vigs_backend *vigs_gl_backend_create(void *display)
     DestroyWindow(tmp_win);
     tmp_win = NULL;
 
+    if (vigs_qt5_enabled()) {
+        qt5_ctx =
+            (HGLRC)vigs_qt5_gl_context_create(gl_backend_wgl->base.is_gl_2);
+        if (!qt5_ctx) {   
+            goto fail;
+        }
+    }
+
     gl_backend_wgl->win = CreateWindow(VIGS_WGL_WIN_CLASS, "VIGSWin",
                                        WS_DISABLED | WS_POPUP,
                                        0, 0, 1, 1, NULL, NULL, 0, 0);
@@ -687,7 +697,7 @@ struct vigs_backend *vigs_gl_backend_create(void *display)
     }
 
     if (!vigs_gl_backend_wgl_create_context(gl_backend_wgl,
-                                            NULL,
+                                            qt5_ctx,
                                             &gl_backend_wgl->ctx)) {
         goto fail;
     }
index fefca0d7d7b135a735482c2669939fa9495d126c..78c788a097abba8156a3fc7b0c4df6c06048b57f 100644 (file)
@@ -38,6 +38,11 @@ extern QApplication *qt5App;
 extern QOpenGLContext *qt5GLContext;
 extern QSurfaceFormat qt5GLFormat;
 
+bool vigs_qt5_enabled(void)
+{
+    return qt5App != NULL;
+}
+
 void *vigs_qt5_display(void)
 {
     if (!qt5App) {
index 5d5d31eb5ddb2e3abd7ef1a96122ebe062be0499..741cf56197e49e00890fd7e69b9e8f93b190a1ff 100644 (file)
@@ -34,6 +34,8 @@
 extern "C" {
 #endif
 
+bool vigs_qt5_enabled(void);
+
 void *vigs_qt5_display(void);
 
 void *vigs_qt5_gl_context_create(bool is_gl2);
index 5f444b45e98e1b67fdd649c974cbf60f85f6c55e..aacfb842f88889b61a058e6479aa0d8355baf189 100644 (file)
@@ -30,6 +30,9 @@
 #include "maru_display.h"
 #include "qt5_supplement.h"
 
+extern QemuMutex sdl_mutex;
+extern QemuCond sdl_cond;
+
 //static Notifier mouse_mode_notifier;
 static int qt5_num_outputs;
 
@@ -103,6 +106,11 @@ void maru_qt5_display_init(MaruDisplayChangeListener *mdcl, int full_screen)
 {
     int i;
 
+#ifdef SDL_THREAD
+    qemu_mutex_init(&sdl_mutex);
+    qemu_cond_init(&sdl_cond);
+#endif
+
     // prepare gui
     qt5_prepare();
 
index 67d9259c4167629176c4d6a3e15ed32965b39025..a7ce433122b34c948c63fe4da4850bfa60263e1c 100644 (file)
@@ -25,13 +25,13 @@ void DisplaySwapper::display()
      */
 
     if (context) {
-        context->makeCurrent();
         while (!terminating) {
+            context->makeCurrent();
             if (qt5_graphic_hw_display()) {
                 context->swapBuffers();
             }
+            context->doneCurrent();
         }
-        context->doneCurrent();
     } else {
         while (!terminating) {
             qt5_graphic_hw_display();