From 7e8f122b6310e3d5ab049f4b42e8d38acec198c3 Mon Sep 17 00:00:00 2001 From: sungmin ha Date: Wed, 16 Jan 2013 14:48:31 +0900 Subject: [PATCH] Fixed a problem about displayed useless line on screenshot --- package/changelog | 3 +++ package/pkginfo.manifest | 2 +- tizen/src/hw/maru_vga.c | 20 ++++++++++++++++++++ tizen/src/maru_display.c | 17 ++++++++++++++++- tizen/src/maru_display.h | 5 +++++ tizen/src/skin/maruskin_operation.c | 16 +++++++++++++--- tizen/src/skin/maruskin_server.c | 7 ++++++- 7 files changed, 64 insertions(+), 6 deletions(-) diff --git a/package/changelog b/package/changelog index 09e73b3..f5ee4d1 100644 --- a/package/changelog +++ b/package/changelog @@ -1,3 +1,6 @@ +* 1.4.60 +- Fixed a problem about displayed useless line on screenshot +== Sungmin Ha 2013-01-16 * 1.4.59 - removed setFocus on mac == GiWoong Kim 2013-01-16 diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 12e77e1..c9d09bb 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,4 +1,4 @@ -Version: 1.4.59 +Version: 1.4.60 Maintainer: Yeong-Kyoon Lee Source: emulator diff --git a/tizen/src/hw/maru_vga.c b/tizen/src/hw/maru_vga.c index c52f8ec..687ee4c 100644 --- a/tizen/src/hw/maru_vga.c +++ b/tizen/src/hw/maru_vga.c @@ -50,8 +50,10 @@ #include "maru_vga_int.h" #include "maru_brightness.h" #include "maru_overlay.h" +#include "maru_display.h" #include "emul_state.h" #include "debug_ch.h" +#include #ifdef USE_SHM #include "emulator.h" @@ -66,6 +68,8 @@ void *shared_memory = (void*)0; MULTI_DEBUG_CHANNEL(qemu, maru_vga); +extern pthread_mutex_t mutex_screenshot; +extern pthread_cond_t cond_screenshot; //#define DEBUG_VGA //#define DEBUG_VGA_MEM @@ -1495,6 +1499,22 @@ static void vga_draw_graphic(VGACommonState *s, int full_update) addr1 = 0; d += linesize; } + + /* for screenshot */ + pthread_mutex_lock(&mutex_screenshot); + MaruScreenshot* maru_screenshot = get_maru_screenshot(); + if ( !maru_screenshot ) { + ERR( "maru screenshot is NULL.\n" ); + } else { + if (maru_screenshot->request_screenshot == 1) { + memcpy(maru_screenshot->pixel_data, s->ds->surface->data, + s->ds->surface->linesize * s->ds->surface->height); + maru_screenshot->request_screenshot = 0; + pthread_cond_signal(&cond_screenshot); + } + } + pthread_mutex_unlock(&mutex_screenshot); + if (y_start >= 0) { /* flush to display */ dpy_update(s->ds, 0, y_start, diff --git a/tizen/src/maru_display.c b/tizen/src/maru_display.c index 99358cd..3f4e1fd 100644 --- a/tizen/src/maru_display.c +++ b/tizen/src/maru_display.c @@ -46,6 +46,7 @@ MULTI_DEBUG_CHANNEL(tizen, display); +MaruScreenshot* maru_screenshot = NULL; //TODO: interface void maru_display_init(DisplayState *ds) @@ -69,12 +70,16 @@ void maru_display_init(DisplayState *ds) #endif register_displaychangelistener(ds, dcl); + + maru_screenshot = g_malloc0(sizeof(MaruScreenshot)); + maru_screenshot->pixel_data = NULL; + maru_screenshot->request_screenshot = 0; } void maru_display_fini(void) { INFO("fini qemu display\n"); - + g_free(maru_screenshot); #ifndef USE_SHM maruskin_sdl_quit(); #else @@ -101,3 +106,13 @@ DisplaySurface* get_qemu_display_surface(void) { return NULL; } +MaruScreenshot* get_maru_screenshot(void) { +#ifndef USE_SHM + return maru_screenshot; +#else + //TODO: +#endif + + return NULL; +} + diff --git a/tizen/src/maru_display.h b/tizen/src/maru_display.h index d0d3c31..617330b 100644 --- a/tizen/src/maru_display.h +++ b/tizen/src/maru_display.h @@ -33,10 +33,15 @@ #include "console.h" +typedef struct MaruScreenshot { + unsigned char *pixel_data; + int request_screenshot; +} MaruScreenshot; void maru_display_init(DisplayState *ds); void maru_display_fini(void); void maruskin_init(uint64 swt_handle, int lcd_size_width, int lcd_size_height, bool is_resize); DisplaySurface* get_qemu_display_surface(void); +MaruScreenshot* get_maru_screenshot(void); #endif /* MARU_DISPLAY_H_ */ diff --git a/tizen/src/skin/maruskin_operation.c b/tizen/src/skin/maruskin_operation.c index ffc7e3a..5e66caa 100644 --- a/tizen/src/skin/maruskin_operation.c +++ b/tizen/src/skin/maruskin_operation.c @@ -61,7 +61,6 @@ MULTI_DEBUG_CHANNEL(qemu, skin_operation); - #define RESUME_KEY_SEND_INTERVAL 500 // milli-seconds #define CLOSE_POWER_KEY_INTERVAL 1200 // milli-seconds #define DATA_DELIMITER "#" // in detail info data @@ -74,6 +73,8 @@ static int guest_x, guest_y; static int pressing_x = -1, pressing_y = -1; static int pressing_origin_x = -1, pressing_origin_y = -1; +extern pthread_mutex_t mutex_screenshot; +extern pthread_cond_t cond_screenshot; static void* run_timed_shutdown_thread(void* args); static void send_to_emuld(const char* request_type, int request_size, const char* send_buf, int buf_size); @@ -356,11 +357,20 @@ QemuSurfaceInfo* get_screenshot_info(void) return NULL; } - memcpy( info->pixel_data, qemu_display_surface->data, length ); + pthread_mutex_lock(&mutex_screenshot); + MaruScreenshot* maru_screenshot = get_maru_screenshot(); + if ( !maru_screenshot ) { + ERR( "maru screenshot is NULL.\n" ); + return NULL; + } + maru_screenshot->pixel_data = info->pixel_data; + maru_screenshot->request_screenshot = 1; + pthread_cond_wait(&cond_screenshot, &mutex_screenshot); + pthread_mutex_unlock(&mutex_screenshot); + info->pixel_data_length = length; return info; - } void free_screenshot_info(QemuSurfaceInfo* info) diff --git a/tizen/src/skin/maruskin_server.c b/tizen/src/skin/maruskin_server.c index 569c6ea..ba07207 100644 --- a/tizen/src/skin/maruskin_server.c +++ b/tizen/src/skin/maruskin_server.c @@ -74,7 +74,6 @@ MULTI_DEBUG_CHANNEL(qemu, skin_server); - #define MAX_REQ_ID 0x7fffffff #define RECV_BUF_SIZE 32 #define RECV_HEADER_SIZE 12 @@ -133,6 +132,9 @@ enum { SEND_SHUTDOWN = 999, }; +pthread_mutex_t mutex_screenshot = PTHREAD_MUTEX_INITIALIZER; +pthread_cond_t cond_screenshot = PTHREAD_COND_INITIALIZER; + static int seq_req_id = 0; static uint16_t svr_port = 0; @@ -245,6 +247,9 @@ void shutdown_skin_server(void) } } + pthread_cond_destroy(&cond_screenshot); + pthread_mutex_destroy(&mutex_screenshot); + stop_server = 1; is_force_close_client = 1; -- 2.7.4