From: Kitae Kim Date: Thu, 31 Jul 2014 02:30:39 +0000 (+0900) Subject: tethering: provide a function to get framebuffer on Mac OS X. X-Git-Tag: TizenStudio_2.0_p3.0~398^2~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50a280fc18461b2b6d35e26108e67255a3ba44c8;p=sdk%2Femulator%2Fqemu.git tethering: provide a function to get framebuffer on Mac OS X. maru_shm module is used to draw display instead of maru_sdl on Mac OS X. so, add a function for extracting framebuffer from display. Change-Id: Ied85db82eef38d2856c60b521ac0490959e3f507 Signed-off-by: Kitae Kim --- diff --git a/tizen/src/display/maru_display.c b/tizen/src/display/maru_display.c index 23dff8f..7616657 100644 --- a/tizen/src/display/maru_display.c +++ b/tizen/src/display/maru_display.c @@ -75,7 +75,7 @@ void maru_display_init(DisplayState *ds) maru_sdl_pre_init(); #endif #else - /* do nothing */ + maru_shm_pre_init(); #endif /* graphics context information */ @@ -114,7 +114,7 @@ void maru_display_update(void) maru_sdl_update(); #endif #else - /* do nothing */ + maru_shm_update(); #endif } diff --git a/tizen/src/display/maru_shm.c b/tizen/src/display/maru_shm.c index cb0f6dc..9d14fcc 100644 --- a/tizen/src/display/maru_shm.c +++ b/tizen/src/display/maru_shm.c @@ -32,15 +32,21 @@ #include #include -#include "maru_shm.h" +#include "qemu/main-loop.h" #include "emul_state.h" +#include "maru_display.h" +#include "maru_shm.h" #include "hw/pci/maru_brightness.h" #include "skin/maruskin_server.h" #include "util/maru_err_table.h" #include "debug_ch.h" +#include "tethering/touch.h" + MULTI_DEBUG_CHANNEL(tizen, maru_shm); +static QEMUBH *shm_update_bh; + static DisplaySurface *dpy_surface; static void *shared_memory = (void *) 0; static int skin_shmid; @@ -89,6 +95,8 @@ static void qemu_ds_shm_update(DisplayChangeListener *dcl, if (is_fit_console_size == true) { maru_do_pixman_dpy_surface(dpy_surface->image); + save_screenshot(dpy_surface); + memcpy(shared_memory, surface_data(dpy_surface), surface_stride(dpy_surface) * @@ -115,6 +123,8 @@ static void qemu_ds_shm_update(DisplayChangeListener *dcl, drop_frame, draw_frame + drop_frame); #endif } + + set_display_dirty(true); } static void qemu_ds_shm_switch(DisplayChangeListener *dcl, @@ -191,6 +201,11 @@ static void qemu_ds_shm_refresh(DisplayChangeListener *dcl) } } +static void maru_shm_update_bh(void *opaque) +{ + graphic_hw_invalidate(NULL); +} + DisplayChangeListenerOps maru_dcl_ops = { .dpy_name = "maru_shm", .dpy_refresh = qemu_ds_shm_refresh, @@ -198,6 +213,11 @@ DisplayChangeListenerOps maru_dcl_ops = { .dpy_gfx_switch = qemu_ds_shm_switch, }; +void maru_shm_pre_init(void) +{ + shm_update_bh = qemu_bh_new(maru_shm_update_bh, NULL); +} + void maru_shm_init(uint64 swt_handle, unsigned int display_width, unsigned int display_height, bool blank_guide) @@ -288,8 +308,27 @@ void maru_shm_resize(void) shm_skip_update = 0; } -bool maru_extract_framebuffer(void* buffer) +void maru_shm_update(void) +{ + if (shm_update_bh != NULL) { + qemu_bh_schedule(shm_update_bh); + } +} + +bool maru_extract_framebuffer(void *buffer) { - INFO("not support on Mac OS X\n"); - return false; + uint32_t buffer_size = 0; + + if (!buffer) { + ERR("given buffer is null\n"); + return false; + } + + maru_do_pixman_dpy_surface(dpy_surface->image); + + buffer_size = surface_stride(dpy_surface) * surface_height(dpy_surface); + TRACE("extract framebuffer %d\n", buffer_size); + + memcpy(buffer, surface_data(dpy_surface), buffer_size); + return true; }