From: SeokYeon Hwang Date: Sun, 9 Aug 2015 06:58:58 +0000 (+0900) Subject: qt5: respect QemuConsole and DisplaySurface X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~40^2~214 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=26788e22290a81efe6a4fcfb6beffc4b95427c76;p=sdk%2Femulator%2Fqemu.git qt5: respect QemuConsole and DisplaySurface Change-Id: I5ae832a2ab72ab3f49aa791ba557430d2a2ab7c6 Signed-off-by: SeokYeon Hwang --- diff --git a/tizen/src/display/qt5.c b/tizen/src/display/qt5.c index f00e0e4c02..e39875847d 100644 --- a/tizen/src/display/qt5.c +++ b/tizen/src/display/qt5.c @@ -33,6 +33,10 @@ #include "qt5_supplement.h" #include "hw/pci/maru_brightness.h" +#include "util/new_debug_ch.h" + +DECLARE_DEBUG_CHANNEL(qt5_console); + /* static Notifier mouse_mode_notifier; */ static int qt5_num_outputs; @@ -63,21 +67,32 @@ int qt5_graphic_hw_display(void) static void qt5_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { - DisplaySurface *surf = qemu_console_surface(dcl->con); - if (!surf) { - return; - } + struct qt5_state *con = container_of(dcl, struct qt5_state, dcl); + + assert(con->surface); - composite_brightness_image(surf->image); + composite_brightness_image(con->surface->image); - qt5_update_internal(surface_data(surf), - surface_width(surf), - surface_height(surf)); + qt5_update_internal(surface_data(con->surface), + surface_width(con->surface), + surface_height(con->surface)); } static void qt5_switch(DisplayChangeListener *dcl, DisplaySurface *new_surface) { + struct qt5_state *con = container_of(dcl, struct qt5_state, dcl); + + if (con->surface && + (surface_width(con->surface) != surface_width(new_surface) || + surface_height(con->surface) != surface_height(new_surface))) { + // TODO: we should adjust display size. + // We should warn to user since we can not adjust display size now. + LOG_WARNING("display size is changed.\n"); + } + + con->surface = new_surface; + } static void qt5_refresh(DisplayChangeListener *dcl) @@ -168,7 +183,6 @@ void maru_qt5_display_init(MaruDisplayChangeListener *mdcl, int full_screen) register_displaychangelistener(&qt5_console[i].dcl); qt5_console[i].idx = i; } - //mdcl->fini = maru_qt5_display_quit; if (full_screen) { /* TODO */ diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index a31de28b48..c064186692 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -652,8 +652,8 @@ const char *get_vm_data_path(void) } // display resolution -static int initial_resolution_width = -1; -static int initial_resolution_height = -1; +int initial_resolution_width = -1; +int initial_resolution_height = -1; #ifdef CONFIG_JAVA_UI static void set_resolution_legacy(void) @@ -685,22 +685,36 @@ void set_initial_display_resolution(int width, int height) int get_display_resolution_width(void) { -#ifdef CONFIG_JAVA_UI +#ifndef CONFIG_JAVA_UI + return qemu_console_get_width(NULL, -1); +#else + if (display_type == DT_MARU_QT_ONSCREEN || + display_type == DT_MARU_QT_OFFSCREEN) { + return qemu_console_get_width(NULL, -1); + } if (initial_resolution_width == -1) { set_resolution_legacy(); } -#endif + // for JAVA_UI return initial_resolution_width; +#endif } int get_display_resolution_height(void) { -#ifdef CONFIG_JAVA_UI - if (initial_resolution_width == -1) { +#ifndef CONFIG_JAVA_UI + return qemu_console_get_height(NULL, -1); +#else + if (display_type == DT_MARU_QT_ONSCREEN || + display_type == DT_MARU_QT_OFFSCREEN) { + return qemu_console_get_height(NULL, -1); + } + if (initial_resolution_height == -1) { set_resolution_legacy(); } -#endif + // for JAVA_UI return initial_resolution_height; +#endif } #ifdef CONFIG_JAVA_UI diff --git a/ui/console.c b/ui/console.c index 60d546e051..118da3e294 100644 --- a/ui/console.c +++ b/ui/console.c @@ -30,8 +30,12 @@ #include "trace.h" #include "exec/memory.h" -#ifdef SDL_THREAD +#ifdef CONFIG_MARU +extern int initial_resolution_width; +extern int initial_resolution_height; +# ifdef SDL_THREAD extern QemuMutex sdl_mutex; +# endif #endif #define DEFAULT_BACKSCROLL 512 @@ -1714,6 +1718,13 @@ QemuConsole *graphic_console_init(DeviceState *dev, uint32_t head, "Guest has not initialized the display (yet)."; int width = 640; int height = 480; +#ifdef CONFIG_MARU + if (initial_resolution_width > 0 && + initial_resolution_height > 0) { + width = initial_resolution_width; + height = initial_resolution_height; + } +#endif QemuConsole *s; DisplayState *ds;