From: Stanislav Vorobiov Date: Wed, 13 Aug 2014 09:23:58 +0000 (+0400) Subject: VIGS/qt5: now working on win32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07a96d09a956ba4288b5a2a3dfc01f356b0989e2;p=sdk%2Femulator%2Fqemu.git VIGS/qt5: now working on win32 Change-Id: I8ffa1d5463d2c72377d419d733c1186856ca4f7d Signed-off-by: Stanislav Vorobiov --- diff --git a/hw/vigs/vigs_device.c b/hw/vigs/vigs_device.c index 61dbb3709f..90bd2af6aa 100644 --- a/hw/vigs/vigs_device.c +++ b/hw/vigs/vigs_device.c @@ -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, diff --git a/hw/vigs/vigs_gl_backend.c b/hw/vigs/vigs_gl_backend.c index 32e7df7629..e66eb0bc3d 100644 --- a/hw/vigs/vigs_gl_backend.c +++ b/hw/vigs/vigs_gl_backend.c @@ -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; diff --git a/hw/vigs/vigs_gl_backend_glx.c b/hw/vigs/vigs_gl_backend_glx.c index 23a4857956..9b478dfc8d 100644 --- a/hw/vigs/vigs_gl_backend_glx.c +++ b/hw/vigs/vigs_gl_backend_glx.c @@ -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); } diff --git a/hw/vigs/vigs_gl_backend_wgl.c b/hw/vigs/vigs_gl_backend_wgl.c index 30eb634f4e..488e2a6a23 100644 --- a/hw/vigs/vigs_gl_backend_wgl.c +++ b/hw/vigs/vigs_gl_backend_wgl.c @@ -29,6 +29,7 @@ #include "vigs_gl_backend.h" #include "vigs_log.h" +#include "vigs_qt5.h" #include #include #include @@ -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; } diff --git a/hw/vigs/vigs_qt5.cpp b/hw/vigs/vigs_qt5.cpp index fefca0d7d7..78c788a097 100644 --- a/hw/vigs/vigs_qt5.cpp +++ b/hw/vigs/vigs_qt5.cpp @@ -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) { diff --git a/hw/vigs/vigs_qt5.h b/hw/vigs/vigs_qt5.h index 5d5d31eb5d..741cf56197 100644 --- a/hw/vigs/vigs_qt5.h +++ b/hw/vigs/vigs_qt5.h @@ -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); diff --git a/tizen/src/display/qt5.c b/tizen/src/display/qt5.c index 5f444b45e9..aacfb842f8 100644 --- a/tizen/src/display/qt5.c +++ b/tizen/src/display/qt5.c @@ -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(); diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp index 67d9259c41..a7ce433122 100644 --- a/tizen/src/ui/mainwindow.cpp +++ b/tizen/src/ui/mainwindow.cpp @@ -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();